home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / v cisle / fma / fma-2.1-beta-4-setup.exe / {app} / CarpeDi3m1687.vbs next >
Text File  |  2006-10-25  |  149KB  |  5,808 lines

  1. Option Explicit
  2. '------------ CarpeDi3m1687.vbscript version 3.5d (see below for actual number) ------------
  3.  
  4. ' :: Requirements ::
  5.  
  6. '       * FMA build "2.1.1.102" or later
  7. '       * Microsoft Script Control engine
  8. '       * WinampControl build "1.3" or later
  9. '       * Float's Media Control "1.5.1.2" or later
  10. '       * WMPuICE control
  11. '         - made by Christian Mueller (http://www.mediatexx.com)
  12.  
  13. ' :: Credits ::
  14.  
  15. '       * iTunes support by daveo
  16. '       * WinDVD control by skyw33
  17. '       * Webcam support (T610) by HRS, eMBee
  18. '       * Mouse Control by Vit Ondruch
  19. '       * Winamp support by CarpeDi3m1687
  20. '       * Internet submenu by mhr
  21. '       * Locate Phone by nossenigma, mhr, hazart
  22. '       * Speech Text by skyw33
  23. '       * WMP 9/10 control by mhr
  24. '       * PowerDVD6 control extended by herb.solo
  25. '       * RadLight control extended by !MOJSO!
  26. '       * Monitor ON/OF control extended by !MOJSO!
  27. ' :: More ::
  28.  
  29. '       * original script created by CarpeDi3m <CarpeDi3m1687@hotmail.com>
  30. '       * send any cool scripts to Dako <z_stoichev AT users.sourceforge.net>
  31. '         if you want to share them with all FMA users.
  32.  
  33. ' :: Notes ::
  34.  
  35. '       * Winamp READ ID3TAGS ON LOAD, must be enabled when using Winamp
  36. '       * Winamp 3.x is not supported
  37. '       * MENU EDITING: Go to script line 247 and enable/disable menu items
  38.  
  39. ' :: Supported Features ::
  40.  
  41.  
  42. '   * Volume Control
  43. '     - mute toggle
  44. '     - master volume control
  45. '     - show current master volume level
  46.  
  47.  
  48.  
  49. ' ---- Media Players ----
  50.  
  51.  
  52. '   * WinAmp 2.x/5.x
  53. '     + dynamic status update
  54. '       - title playing song
  55. '       - playing status current song
  56. '       - song position (songinfo)
  57. '     + automatic reload of playlist (when songs are added, removed or a playlist is chosen)
  58. '     + functions:
  59. '      * prev/next track (joystick left/right)
  60. '      * playlist selection
  61. '      * volume (volume buttons -/+)
  62. '      * seek playing song
  63. '      * launch/close Winamp
  64. '      * standard play functions
  65. '         + play
  66. '         + resume
  67. '         + pause/stop
  68. '      * search
  69. '         + artist/band
  70. '         + title
  71. '         + show all artists/bands
  72. '      * main options (press option button)
  73. '         + shuffle on/off
  74. '         + repeat on/off
  75. '         + reload playlist
  76. '      * playlist (select playing song)
  77. '         + prev/next songs (joystick left/right)
  78. '         + Songinfo (select playing song)
  79. '           - Normal/Detailed info (joystick left/right)
  80. '         + playlistoptions (press option button)
  81. '           - Search title (press */# to go to previous/next result within playlist)
  82. '           - Goto song#
  83. '           - Seek current song
  84. '           - Reload playlist
  85.  
  86. '  * Windows Media Player 9/10
  87. '     + launch/close WMP (if launching takes more than 8 secs, error is returned)
  88. '     + dynamic status update
  89. '     + standart controls
  90. '        - play
  91. '        - pause
  92. '        - stop
  93. '        - previous, next item in playlist (using < and > buttons while in Media player menu)
  94. '     + editing current media item (you can change Artist and Title) - option key
  95. '     + playrate changing (speed) 50-200% (works only on audio files)
  96. '     + current playlist listing (click on current media item)
  97. '        - jumping to specific page using # button
  98. '        - previous/next page < and >
  99. '        - jumping to clicked item
  100. '     + browsing all playlists (including auto playlists)
  101. '        - playlist selection
  102. '     + searching media library
  103. '        - by author
  104. '        - by name
  105. '        - by album
  106. '        - by genre
  107. '         * WARNING: first search returns only EXACT matches
  108. '           clicking Continue search will return substring matches as well
  109. '     + shuffle/repeat: on/off
  110. '     + fullscreen
  111.  
  112. '   * PowerDVD
  113. '     - standard play functions ( play, pause, stop, prev/next chapter, step backward/forward )
  114. '     - capture frame (Camera button)
  115. '     - switch between (Chapter / Faster / Jump) forward-rewind
  116. '     - audiostream toggle
  117. '     - subtitle toggle
  118. '     - volume (+/- 5)
  119. '     - mute toggle
  120. '     - fullscreen toggle
  121. '     - switch fullscreen mode on/off (will prevent player from popping up when in fullscreen mode)
  122. '     - set repeat point
  123. '     - launch/close PowerDVD
  124. '     - fast forward / rewind
  125. '     - jump 5 seconds forward / back
  126.  
  127. '   * BSPlayer
  128. '     - standard play functions ( play, pause, stop, prev, next, )
  129. '     - fullscreen toggle
  130. '     - subtitle on/off
  131. '     - zoom
  132. '     - launch/close BSPlayer
  133.  
  134. '   * Zoom Player
  135. '     - standard play functions ( play, pause, stop, prev, next )
  136. '     - prev/next
  137. '     - fast forward/reverse
  138. '     - jump ahead/back
  139. '     - fullscreen toggle
  140. '     - subtitle on/off
  141. '     - mute
  142. '     - launch/close Zoom Player
  143.  
  144. '   * WinDVD
  145. '     - Play/Select
  146. '     - Pause
  147. '     - Stop
  148. '     - Prev/Next Chapter
  149. '     - Audiostream Toggle
  150. '     - Subtitles
  151. '     - Volume Up/Down
  152. '     - Mute/UnMute
  153. '     - Full Screen
  154. '     - Speed Up/Down
  155. '     - Fast Forward/Rewind
  156. '     - Step Forward/Backward
  157. '     - DVD navigation (left, right, up, down, main menu, select)
  158. '     - Launch/Close WinDVD
  159.  
  160. ''   * RadLight
  161. '     - standard play functions ( play, pause, stop, prev, next )
  162. '     - prev/next
  163. '     - fast forward/reverse
  164. '     - jump ahead/back
  165. '     - fullscreen toggle
  166. '     - subtitle on/off     
  167. '     - launch/close RadLight
  168. '                    Tested on RadLight version 3.03 [R5]   
  169. '                                 created by !MOJSO! <mojsovski@gmail.com>
  170.  
  171. ' ---- TV software ----
  172.  
  173. '   * Hauppauge WinTV
  174. '     - remote mode (enter numbers)
  175. '     - mute toggle
  176. '     - fullscreen toggle
  177. '     - prev/next channel (joystick left/right)
  178. '     - freeze image
  179. '     - make snapshot (Camera button)
  180. '     - select source
  181. '     - launch/close WinTV
  182.  
  183. '   * MoreTV
  184. '     - remote mode (enter numbers)
  185. '     - mute toggle
  186. '     - fullscreen toggle
  187. '     - prev/next channel (joystick left/right)
  188. '     - launch/close MoreTV
  189.  
  190. '   * DScaler
  191. '     - remote mode (enter numbers)
  192. '     - mute toggle
  193. '     - fullscreen toggle
  194. '     - last channel
  195. '     - prev/next channel (joystick left/right)
  196. '     - freeze image
  197. '     - make snapshot (Camera button)
  198. '     - start/stop recording
  199. '     - preview
  200. '     - teletext
  201. '     - zoom +/-
  202. '     - launch/close DScaler
  203.  
  204.  
  205. ' ---- Misc ----
  206.  
  207. '   * File Manager
  208. '     - Browse folders
  209. '     - Open files
  210. '     - Browse Info
  211. '     - browse up  ( press c )
  212.  
  213. '   * PowerPoint
  214. '     - start show
  215. '     - next slide
  216. '     - prev slide
  217. '     - toggle screen
  218. '     - end show
  219.  
  220. '   * iTunes
  221. '     - Play/Pause
  222. '     - Stop
  223. '     - Prev Track
  224. '     - Next Track
  225. '     - Vizualizer
  226. '     - Launch/Close
  227.  
  228. '   * Mouse Control
  229. '     - enter text (press *)
  230. '     - Enter key (press #)
  231.  
  232. '   * Misc Control
  233. '     + disconnect fma
  234. '     + lock workstation
  235. '     + shutdown
  236. '       - shutdown
  237. '       - hibernate
  238. '       - reboot
  239. '       - Monitor ON/OF To work properly insert a corect program location of Floats` Mobile Agent  Go to script line 284  (fmadir = C:\Program Files\Fma 2) 
  240. '                         Monitor on/of  created by !MOJSO! <mojsovski@gmail.com>
  241.  
  242. '   * Internet browsing using MSIE
  243. '     - entering address
  244. '     - navigating to homepage
  245. '     - sending e-mail using default email program
  246. '     - forward/back (also using < >)
  247. '     - navigating in IE using volume keys
  248. '     - enter text (press *)
  249. '     - enter key (press #)
  250.  
  251.  '---- config ----
  252.  
  253.  
  254. '   * Custom MenuSettings (option button)
  255. '     - selection of menu items
  256. '     - sorting of menu items
  257. '     - selection of phone [T610/k700/t68i]    (default: T610)
  258. '     - option to save settings in a config-file (default: off)
  259. '
  260. '   * Main Settings
  261. '     + on call
  262. '       - mute
  263. '       - decrease master volume
  264. '       - pause Winamp
  265. '   * calling FMA menu with # key (hold 2.5+seconds)from anywhere outside FMA menu
  266. '
  267.  
  268.  
  269. ' :: Implementation ::
  270.  
  271.  
  272.  
  273. '************ Change these settings as needed *************
  274.  
  275. Public FileName
  276. Public OutputDirectory
  277. Public ProgramDir
  278. Public fmadir
  279.  
  280. ProgramDir = "C:\Program Files" 'for englisch systems
  281. 'ProgramDir = "C:\Programme" 'for german systems
  282.  
  283. WinampDir = "C:\Program Files\Winamp5"
  284. fmadir = fma.MobileAgentFolder      'Float's Mobile Agent Directory
  285.  
  286. Sub setDefault()
  287.   FileName = "/Pictures/Picture(1).jpg"
  288.   OutputDirectory = "C:\"
  289.  
  290.   SettingsFile = "C:\CarpeDi3m1687.sav"                'file-location for saving user-settings
  291.   PlaylistPath = "C:\Playlists"
  292.  
  293.   SaveSettingsBool     = FALSE        'default saving setting
  294.   SettingMuteOnCall     = 2        'default mute music on call 0 = false, 1 = true, 2 = set volume value, 3 = pause winamp
  295.   OnCallDecreaseValue    = 40
  296.   SettingStartOnConnect = TRUE        'default autostart (currently not working)
  297.  
  298.   MyPhoneType(1)         = 1    'default selected phone (T610)
  299.   setPhone                'load values for selected phone
  300.  
  301.  
  302.   ReDim RootItems(0) 'Menu-items listed default as shown in current order
  303.  
  304.  
  305. '--------------------- menu order ------------------------------
  306. '  addRootItem(0)        'Hauppauge WinTV
  307. '  addRootItem(1)        'MoreTV
  308.   addRootItem(2)        'Winamp
  309.   addRootItem(3)        'PowerDVD 6.0
  310. '  addRootItem(4)        'BSPlayer
  311.   addRootItem(5)        'Media Player 9/10
  312.   addRootItem(6)        'Volume Control
  313.   addRootItem(7)        'PowerPoint
  314.   addRootItem(8)        'Misc Control
  315.   addRootItem(9)        'Mouse Control
  316. '  addRootItem(10)        'WinDVD
  317. '  addRootItem(11)        'i-Tunes
  318. '  addRootItem(12)        'DScaler
  319. '  addRootItem(13)        'Zoom-Player
  320.   addRootItem(14)        'Browse Files
  321.   addRootItem(15)        'Iexplore
  322.   addRootItem(16)       'RadLight
  323. '--------------------- menu order ------------------------------
  324.  
  325. '********************** end custom config **********************
  326.  
  327.  
  328.  
  329.   ScriptVersion        = "3.5b"     'current script version for tracking config file
  330.   NrSongsOnPage = 6            'nr songs in playlist
  331. End Sub
  332.  
  333. Public RootID        'rows are ordered by ID
  334. Public RootEXE
  335.  
  336. Sub initRootID()          'inits all menuitems
  337.   Redim RootEXE(16)
  338.  
  339. '************ Change these settings as needed *************
  340.  
  341.   RootEXE(0) = ProgramDir & "\WinTV\WinTV2K.EXE"
  342.   RootEXE(1) = ProgramDir & "\MoreTV.353\MoreTV.exe"
  343.   RootEXE(2) = WinampDir & "\winamp.exe"
  344.   RootEXE(3) = ProgramDir & "\CyberLink\PowerDVD\PowerDVD.exe"
  345.   RootEXE(4) = ProgramDir & "\Webteh\BSplayer\bplay.exe"
  346.   RootEXE(5) = "wmplayer.exe"
  347.  
  348.   RootEXE(6) = "" 'NOT USED volume control
  349.   RootEXE(7) = "" 'NOT USED powerpoint
  350.   RootEXE(8) = "" 'NOT USED misc control
  351.   RootEXE(9) = "" 'NOT USED mouse control
  352.  
  353.   RootEXE(10) = ProgramDir & "\InterVideo\DVD6\WinVD.exe"
  354.   RootEXE(11) = "iTunes.exe"
  355.   RootEXE(12) = ProgramDir & "\DScaler\DScaler.EXE"
  356.   RootEXE(13) = ProgramDir & "\Zoomplayer\ZPlayer.exe"
  357.  
  358.   RootEXE(14) = "" 'NOT USED browse files
  359.   RootEXE(15) = ProgramDir & "\Internet Explorer\iexplore.exe" 'internet expl
  360.   RootEXE(16) = ProgramDir & "\RadLight\RadLight3\RadLight.exe"
  361. '********************** end custom config **********************
  362.  
  363.   Redim RootID(16,2)
  364.   RootID(0,0) = 0                                     'id
  365.   RootID(0,1) = "Win TV"                           'name in menu
  366.   RootID(0,2) = "enterWinTV"                     'method to enter menu
  367.  
  368.   RootID(1,0) = 1
  369.   RootID(1,1) = "MoreTV"
  370.   RootID(1,2) = "enterMoreTV"
  371.  
  372.   RootID(2,0) = 2
  373.   RootID(2,1) = "Winamp"
  374.   RootID(2,2) = "enterWinamp"
  375.  
  376.   RootID(3,0) = 3
  377.   RootID(3,1) = "PowerDVD 6.0"
  378.   RootID(3,2) = "enterPowerDVD"
  379.  
  380.   RootID(4,0) = 4
  381.   RootID(4,1) = "BSPlayer"
  382.   RootID(4,2) = "enterBSPlayer"
  383.  
  384.   RootID(5,0) = 5
  385.   RootID(5,1) = "Media Player"
  386.   RootID(5,2) = "enterMediaPlayer"
  387.  
  388.   RootID(6,0) = 6
  389.   RootID(6,1) = "Volume Control"
  390.   RootID(6,2) = "enterVolumeControl"
  391.  
  392.   RootID(7,0) = 7
  393.   RootID(7,1) = "PowerPoint"
  394.   RootID(7,2) = "enterPowerPoint"
  395.  
  396.   RootID(8,0) = 8
  397.   RootID(8,1) = "Misc Control"
  398.   RootID(8,2) = "enterMiscControl"
  399.  
  400.   RootID(9,0) = 9
  401.   RootID(9,1) = "Mouse Control"
  402.   RootID(9,2) = "enterMouseControl"
  403.  
  404.   RootID(10,0) = 10
  405.   RootID(10,1) = "WinDVD"
  406.   RootID(10,2) = "enterWinDVD"
  407.  
  408.   RootID(11,0) = 11
  409.   RootID(11,1) = "iTunes"
  410.   RootID(11,2) = "enterITunes"
  411.  
  412.   RootID(12,0) = 12
  413.   RootID(12,1) = "DScaler"
  414.   RootID(12,2) = "enterDScaler"
  415.  
  416.   RootID(13,0) = 13
  417.   RootID(13,1) = "Zoom Player"
  418.   RootID(13,2) = "enterZoomPlayer"
  419.  
  420.   RootID(14,0) = 14
  421.   RootID(14,1) = "Browse Files"
  422.   RootID(14,2) = "enterBrowse"
  423.  
  424.   RootID(15,0) = 15
  425.   RootID(15,1) = "Browse WWW"
  426.   RootID(15,2) = "enterExplorer"
  427.  
  428.   RootID(16,0) = 16
  429.   RootID(16,1) = "RadLight"
  430.   RootID(16,2) = "enterRadLight"
  431. End Sub
  432.  
  433.  
  434. Sub setGotoMethod(m)
  435.   GotoMethodValue = m
  436. End Sub
  437.  
  438. Sub gotoMethod()        'called after exiting volume
  439.   CurrentItem = ""    '##################
  440.   Select Case CurrentID
  441.     Case "onAMRoot"  onAMRoot
  442.     Case "settings"
  443.       Select Case GotoMethodValue
  444.         Case "enterSettings"  enterSettings
  445.         Case "gotoSelect"     gotoSelect
  446.         Case "gotoOrder"      gotoOrder
  447.       End Select
  448.  
  449.     Case 0
  450.       If (GotoMethodValue = "channelList") Then
  451.         channelList
  452.       Else
  453.         enterWinTV
  454.       End If
  455.  
  456.     Case 1
  457.       If (GotoMethodValue = "channelList") Then
  458.         channelList
  459.       Else
  460.         enterMoreTV
  461.       End If
  462.  
  463.     Case 2
  464.       Select Case GotoMethodValue
  465.         Case "enterWinamp"    enterWinamp
  466.         Case "winampSearch"   winampSearch
  467.         Case "simpleSearch"   simpleSearch
  468.         Case "allArtists"     allArtists
  469.         Case "artistResults"  artistResults
  470.         Case "playList"       playList LastArg1
  471.         Case "songInfo"       songInfo LastArg1
  472.         Case "songInfo2"      songInfo2
  473.         Case "enterSeek"      enterSeek
  474.         Case "winampOptions"  winampOptions
  475.         Case "browsePlaylist" browsePlaylist
  476.       End Select
  477.  
  478.     Case 3  enterPowerDVD
  479.     Case 4  enterBSPlayer
  480.     Case 5  enterMediaPlayer
  481.     Case 6  enterVolumeControl
  482.     Case 7  enterPowerPoint
  483.     Case 8  enterMiscControl
  484.     Case 10 enterWinDVD
  485.     Case 11 enterITunes
  486.  
  487.     Case 12
  488.       If (GotoMethodValue = "channelList") Then
  489.         channelList
  490.       Else
  491.         enterDScaler
  492.       End If
  493.  
  494.     Case 13 enterZoomPlayer
  495.     Case 14 enterBrowse
  496.     Case 15 enterExplorer
  497.     Case 16 enterRadLight
  498.   End Select
  499. End Sub
  500.  
  501.  
  502. Sub setMenuItems(a1,a2)            'setting menu items according index values of array a1
  503.   Dim e                    'element is index (integer)
  504.   For Each e in a1
  505.     am.AddItem a2(e,1), a2(e,2)        'name in menu and function for entering Menu
  506.   Next
  507. End Sub
  508.  
  509. Sub setPhone()
  510.   If (MyPhoneType(1)=1) Then        'T610
  511.     ScreenWidth        = 111            'usable screenwidth
  512.     SpaceOption        = 3
  513.     MenuItemExitMenu    = "      [ exit menu ]"
  514.  
  515.     BackButton = ":R"
  516.     CameraButton = ":C"
  517.     OptionButton = "]"
  518.     OkButton = "["
  519.   ElseIf (MyPhoneType(1)=2) Then    'K700i
  520.     ScreenWidth        = 111            'usable screenwidth
  521.     SpaceOption        = 3
  522.     MenuItemExitMenu    = "   < [ exit menu ] >"
  523.  
  524.     BackButton = ":R"
  525.     CameraButton = ":C"
  526.     OptionButton = "]"
  527.     OkButton = "["
  528.   ElseIf (MyPhoneType(1)=3) Then    'T68i
  529.     ScreenWidth        = 84            'usable screenwidth
  530.     SpaceOption        = 2
  531.     MenuItemExitMenu    = "   <<< ( exit ) >>>"
  532.  
  533.     BackButton = "c"
  534.     CameraButton = "Not available"
  535.     OptionButton = "f"
  536.     OkButton = "s"
  537.   End If
  538. End Sub
  539.  
  540. '***********************************************************
  541. Public ScreenWidth        'phone dependable screen width
  542. Public SpaceOption
  543.  
  544. Public WinampDir
  545. Public NrSongsOnPage            'smaller or equal to 10
  546.  
  547. Public BackButton
  548. Public CameraButton
  549. Public OptionButton        'option button on phone
  550. Public OkButton
  551.  
  552. Public MenuItemExitMenu        'interface text
  553.  
  554. Public SelectItem        'needed for sorting menu
  555.  
  556. Public GotoMethodValue        'is used to save position upon entering option or volume
  557.  
  558. Public LastArg1
  559.  
  560. Public TempArray        'needed for temporary passing of values "sorted array" and used in search
  561. Public TempArray2
  562.  
  563. Public GetPlayListBool
  564.  
  565. Public EnableKeys     'peform keyevents
  566.  
  567. Public Fso, File        'file read and write variables
  568. Public SettingsFile
  569.  
  570. Public MyPhoneType(1)         'Phone selection: 1 = T610; 2 = K700i; 3 = t68i;
  571. MyPhoneType(0) = 3          'Number of phones - used in phone switching sub
  572. Public ScriptVersion
  573.  
  574. Public SaveSettingsBool
  575. Public SettingMuteOnCall
  576. Public OnCallDecreaseValue
  577. Public SettingStartOnConnect
  578.  
  579. Public VolumeBackup
  580.  
  581. Public VolumeCtrl        'objects
  582. Public WinampCtrl
  583. Public WinampVol
  584. Public MouseCtrl
  585. Public WMPplugin
  586. Public WMPCtrl
  587. Public WMPplginI
  588. Public Shell
  589.  
  590. Public AppOpen
  591.  
  592. Public BSPlayerZoomValue
  593.  
  594. Public RootItems        'Array of application ID's     note: RootItems(0) is empty and not used for implementing reasons
  595.  
  596. Public CurrentID        'running menu
  597. Public CurrentItem        'running menutitem
  598.  
  599. Public EnableMouseControl
  600. Public PlaylistPath
  601.  
  602. ' "T610 as a webcam". Copyright (c) 2004 HRS.
  603.  
  604. ' this script remotely triggers the camera of the T610,
  605. ' transfers the taken picture on the local pc and
  606. ' deletes it from the camera.
  607.  
  608. ' path and FileName of the picture on the camera
  609. ' output directory for the transferred files on the local pc
  610. ' terminating backslash required
  611.  
  612.  
  613. Sub OnInit()
  614.   'Reapply settings (usualy after editing the script inside FMA)
  615.   OnDisconnected
  616.   OnConnected
  617.  
  618.   'Add main menu options
  619.   fma.AddCmd "How to build your own scripts?", "OnFMAScriptHowto"
  620.   fma.AddCmd "-", ""
  621.   fma.AddCmd "Take a picture", "OnTakeSinglePicture"
  622.   fma.AddCmd "-", ""
  623.   fma.AddCmd "Start Webcam (loop)", "OnStartWebcam"
  624.   fma.AddCmd "Start Webcam (stream)", "OnStartWebcamStream"
  625.   fma.AddCmd "-", ""
  626.   fma.AddCmd "Stop Webcam", "OnStopWebcam"
  627.   fma.AddCmd "-", ""
  628.   fma.AddCmd "Locate the phone", "OnLocatePhone"
  629. End Sub
  630.  
  631. Sub OnConnected()
  632.   initRootID            'setting default menu-items
  633.  
  634.   'OnConnected is called in offline mode from OnInit
  635.   'so we should take care of this
  636.   If fma.Connected = 1 Then
  637.      am.Init                             'Initialize the Accessories Menu
  638.      am.DlgMsgBox "Connected to floAt's Mobile Agent", 2
  639.   Else
  640.      am.Clear
  641.   End If
  642.  
  643.   Set Shell = CreateObject("WScript.Shell")
  644.   Set VolumeCtrl = CreateObject("floAtMediaCtrl.VolumeCtrl")
  645.   Set Fso = CreateObject("Scripting.FileSystemObject")        'FileSystemObject created for reading and writing files
  646.   Set WinampCtrl = CreateObject("WinampCOMLib.WinampCOMObj")
  647.   Set MouseCtrl = CreateObject("floAtMediaCtrl.MouseCtrl")
  648. On Error Resume Next
  649.   Set WMPplugin = CreateObject("WMPuICE.WMPApp")
  650.   WMPplginI = null
  651.   WMPplginI = WMPplugin.Running
  652. On Error GoTo 0
  653.   If (IsNull(WMPplginI)) Then WMPplginI=FALSE Else WMPplginI=TRUE
  654.  
  655.   EnableMouseControl = 0
  656.  
  657.   VolumeCtrl.GradualVol = True
  658.  
  659.   ReDim RootItems(0)
  660.   ReDim PlayListArray(0)
  661.   ReDim TempArray(0)
  662.   ReDim TempArray2(0)
  663.   CurrentID = ""        'Refers to Application
  664.   CurrentItem = ""      'Refers to Item within application menu
  665.   UseSearchPlayList = FALSE
  666.  
  667.   setDefault            'set default user settings
  668.   readSettings            'read stored user settings (if config file is available)
  669.  
  670.   GetPlayListBool = TRUE
  671.  
  672.   BSPlayerZoomValue = 1
  673.  
  674.   WinampCtrl.PathExe = WinampDir
  675.  
  676.   WinampVol = 128
  677.   WinampCtrl.SetVolume = WinampVol
  678.   VolumeBackup = VolumeCtrl.Volume
  679.  
  680.   WinampCtrl.GetPlaylistMode = 1
  681.  
  682.   If fma.Connected = 1 Then
  683.     Transmit "AT*EAST=" & Chr(34) & "Fma Remote" & Chr(34)
  684.     fma.enablekeymonitor
  685.     If (SettingStartOnConnect) Then onAMRoot
  686.   End If
  687.  
  688. End Sub
  689.  
  690. Sub OnDisconnected()
  691.   deleteTimers               'delete timers used in winamp and wmp
  692.   ReDim RootItems(0)
  693.   ReDim PlayListArray(0)
  694.   ReDim TempArray(0)
  695.   ReDim TempArray2(0)
  696.   CurrentID = ""
  697.   CurrentItem = ""
  698.  
  699.   Set Shell = Nothing
  700.   Set Fso = Nothing
  701.   Set VolumeCtrl = Nothing
  702.   Set WinampCtrl = Nothing
  703.   Set MouseCtrl = Nothing
  704.   Set WMPplugin = Nothing
  705.   Set WMPCtrl = Nothing
  706. End Sub
  707.  
  708. Sub OnConnectionLost()
  709.   'OnDisconnected
  710. End Sub
  711.  
  712. Sub OnNewSMS(from,msg)
  713. End Sub
  714.  
  715. Sub OnProximity(state) '1: away, 0: near
  716. End Sub
  717.  
  718. Sub OnCall(state,n1,n2)    'state "alerting"  | "calling" | "connecting" | "active"
  719. End Sub
  720.  
  721. Sub OnMusicMute(state)
  722.   If (state = 1) Then    'incoming call -> mute
  723.     EnableKeys = FALSE
  724.     VolumeBackup = VolumeCtrl.Volume
  725.     Select Case SettingMuteOnCall
  726.       Case 0
  727.       Case 1
  728.          VolumeCtrl.Volume = 0   'decrease volume
  729.          VolumeCtrl.Mute = 1     'mute volume
  730.       Case 2
  731.         VolumeCtrl.Volume = (VolumeBackup-OnCallDecreaseValue)
  732.       Case 3
  733.         WinampCtrl.Pause  'pause Winamp
  734.     End Select
  735.   Else                'call ended (state = 0) -> unmute
  736.     EnableKeys = FALSE
  737.     Select Case SettingMuteOnCall
  738.       Case 0
  739.       Case 1
  740.         VolumeCtrl.Mute = 0              'unmute
  741.         VolumeCtrl.Volume = VolumeBackup 'restore old volume value
  742.       Case 2
  743.         VolumeCtrl.Volume = VolumeBackup 'restore old volume value
  744.       Case 3
  745.         WinampCtrl.Play
  746.     End Select
  747.   End If
  748. End Sub
  749.  
  750.  
  751. 'Active Menu Start ---------------------------------------------------------
  752. 'onAMRoot will be called when Connection/Extra->Accessories->FMA is selected
  753. 'Something that's not shown here is am.Back = "Event", will call procedure
  754. 'specified rather than go back to the previous menu
  755.  
  756. Sub onAMRoot()
  757.   am.Clear
  758. 'id=13
  759.   EnableKeys = TRUE
  760.  
  761.   CurrentID = "onAMRoot"
  762.   CurrentItem = "menu"
  763.  
  764.   If (MyPhoneType(1)=1) Then
  765.    am.Title = "T610 control"
  766.   ElseIf (MyPhoneType(1)=2) Then
  767.    am.Title = "K700i control"
  768.   ElseIf (MyPhoneType(1)=3) Then
  769.    am.Title = "T68i control"
  770.   End If
  771.  
  772.   setMenuItems RootItems, RootID    'set root
  773.  
  774.   am.AddItem center("[ settings ]",""), "enterSettings"
  775.   am.AddItem center("[ about ]",""), "about"
  776.  
  777.   am.back = "exitRoot"
  778.   am.Update
  779. End Sub
  780.  
  781. Sub exitRoot
  782.   EnableKeys = FALSE
  783.   CurrentID = ""
  784. End Sub
  785.  
  786. Sub CloseAppDlg
  787.   am.clear
  788.   am.Title = "Closing"
  789.   am.AddItem "Cancel", "onAMRoot"
  790.  
  791.   am.DlgFeedBack "Closing...","onAMRoot"
  792.   am.update
  793. End Sub
  794. Sub LaunchAppDlg
  795.   am.clear
  796.   am.Title = "Launching"
  797.   am.AddItem "Cancel", "onAMRoot"
  798.  
  799.   am.DlgFeedBack "Launching...","onAMRoot"
  800.   am.update
  801. End Sub
  802.  
  803. Public ItemPressMethod
  804.  
  805. Sub setItemPress(m)        'redirect to function
  806.   ItemPressMethod = m
  807. End Sub
  808.  
  809. Sub itemPress(i)        'check goto method
  810.   Select Case ItemPressMethod
  811.     Case "clickOnSong"      clickOnSong i
  812.     Case "toggleOption"     toggleOption i
  813.     Case "clickOnFile"      clickOnFile i
  814.     Case "moveItemUp"       moveItemUp i
  815.     Case "songsByArtist"    songsByArtist i
  816.     Case "sendKey"          sendKey i
  817.     Case "mp9PsClick"       mp9PsClick i
  818.     Case "mp9PClick"        mp9PClick i
  819.   End Select
  820. End Sub
  821.  
  822.  
  823. Sub itemPress0()        'e.g. clicked on song-event
  824.   itemPress 0          'click on top item of list
  825. End Sub
  826. Sub itemPress1()        'e.g. clicked on song-event
  827.   itemPress 1            'click on 2nd item of list
  828. End Sub
  829. Sub itemPress2()
  830.   itemPress 2
  831. End Sub
  832. Sub itemPress3()
  833.   itemPress 3
  834. End Sub
  835. Sub itemPress4()
  836.   itemPress 4
  837. End Sub
  838. Sub itemPress5()
  839.   itemPress 5
  840. End Sub
  841. Sub itemPress6()
  842.   itemPress 6
  843. End Sub
  844. Sub itemPress7()
  845.   itemPress 7
  846. End Sub
  847. Sub itemPress8()
  848.   itemPress 8
  849. End Sub
  850. Sub itemPress9()
  851.   itemPress 9
  852. End Sub
  853. Sub itemPress10()
  854.   itemPress 10
  855. End Sub
  856. Sub itemPress11()
  857.   itemPress 11
  858. End Sub
  859. Sub itemPress12()
  860.   itemPress 12
  861. End Sub
  862. Sub itemPress13()
  863.   itemPress 13
  864. End Sub
  865. Sub itemPress14()
  866.   itemPress 14
  867. End Sub
  868. Sub itemPress15()
  869.   itemPress 15
  870. End Sub
  871. Sub itemPress16()
  872.   itemPress 16
  873. End Sub
  874. Sub itemPress17()
  875.   itemPress 17
  876. End Sub
  877. Sub itemPress18()
  878.   itemPress 18
  879. End Sub
  880.  
  881. '------------------------ array functions-------------------------
  882.  
  883. Function elementOf(c,arr)    'determines whether 'c' is element of Array arr
  884.   Dim e
  885.  
  886.   For Each e In arr
  887.     If (c = e) Then
  888.       elementOf = TRUE
  889.       Exit Function
  890.     End If
  891.   Next
  892.  
  893.   elementOf = FALSE
  894. End Function
  895.  
  896. Sub removeElement(id,a)        'remove method with element search
  897.   Dim i
  898.   For i=0 To UBound(a)
  899.     If (a(i) = id) Then
  900.         removeElementAt i, a
  901.         Exit For
  902.     End If
  903.   Next
  904. End Sub
  905.  
  906. Sub removeElementAt(index,a)    'remove method with index argument
  907.   Dim i, limit
  908.   limit = UBound(a)
  909.   For i=index To limit-1
  910.     a(i) = a(i+1)
  911.   Next
  912.   ReDim Preserve a(limit-1)
  913. End Sub
  914.  
  915. Sub addElement(id,a)        'add method at end of array
  916.   Dim i, limit
  917.  
  918.   If (a(0) = "") Then        'fill complete array
  919.     a(0) = id
  920.   Else
  921.     limit = UBound(a)
  922.     ReDim Preserve a(limit+1)
  923.     a(limit+1) = id
  924.   End If
  925. End Sub
  926.  
  927.  
  928. '------------------ filters a string----------------------
  929. 'needed for filtering unicode char which causes lockups
  930.  
  931. Function filter(str)                'filters a String
  932.   Dim i, s
  933.   s = Trim(Str)
  934.   'For i=128 To 149
  935.   '  s = replace(s,Chr(i),"")
  936.   'Next
  937.   s = replace(s,"`","'")
  938.   s = replace(s,Chr(128),"Euro")  'safe
  939.   s = replace(s,Chr(129),"")
  940.   s = replace(s,Chr(130),",")  'safe
  941.   s = replace(s,Chr(131),"f")  'safe
  942.   s = replace(s,Chr(132),",,")  'safe
  943.   s = replace(s,Chr(133),"...")
  944.   s = replace(s,Chr(134),"+")
  945.   s = replace(s,Chr(135),"++")
  946.   s = replace(s,Chr(136),"^")
  947.   s = replace(s,Chr(137),"%")
  948.   s = replace(s,Chr(138),"S")
  949.   s = replace(s,Chr(139),"<")
  950.   s = replace(s,Chr(140),"CE")
  951.   s = replace(s,Chr(141),"")
  952.   s = replace(s,Chr(142),"Z")
  953.   s = replace(s,Chr(143),"")
  954.   s = replace(s,Chr(144),"")
  955.   s = replace(s,Chr(145),"'")
  956.   s = replace(s,Chr(146),"'")
  957.   s = replace(s,Chr(147),"''")
  958.   s = replace(s,Chr(148),"''")
  959.   s = replace(s,Chr(149),".")
  960.   s = replace(s,Chr(150),"-")
  961.   s = replace(s,Chr(151),"--")
  962.   s = replace(s,Chr(152),"~") 'safe
  963.   s = replace(s,Chr(153),"tm")
  964.   s = replace(s,Chr(154),"s")
  965.   s = replace(s,Chr(155),">")
  966.   s = replace(s,Chr(156),"oe")
  967.   s = replace(s,Chr(157),"")
  968.   s = replace(s,Chr(158),"z")
  969.   s = replace(s,Chr(159),"y")
  970.   s = replace(s,Chr(160)," ")
  971.   s = replace(s,Chr(161),"i")
  972.   s = replace(s,Chr(162),"c")
  973.   s = replace(s,Chr(163),"Pound")
  974.   s = replace(s,Chr(164),"x")
  975.   s = replace(s,Chr(165),"y")
  976.   s = replace(s,Chr(166),"|")
  977.   s = replace(s,Chr(167),"s")
  978.   s = replace(s,Chr(168),"''")
  979.   s = replace(s,Chr(169),"C")
  980.   s = replace(s,Chr(170),"a")
  981.   s = replace(s,Chr(171),"<<")
  982.   s = replace(s,Chr(172),"")
  983.   s = replace(s,Chr(173),"")
  984.   s = replace(s,Chr(174),"R")
  985.   s = replace(s,Chr(175),"")
  986.   s = replace(s,Chr(176),"o")
  987.   s = replace(s,Chr(177),"+-")
  988.   s = replace(s,Chr(178),"2")
  989.   s = replace(s,Chr(179),"3")
  990.  
  991.   s = replace(s,Chr(180),"'")
  992.   s = replace(s,Chr(181),"u")
  993.   s = replace(s,Chr(182),"")
  994.   s = replace(s,Chr(183),".")
  995.   s = replace(s,Chr(184),",")
  996.  
  997.   s = replace(s,Chr(185),"1")
  998.   s = replace(s,Chr(186),"o")
  999.   s = replace(s,Chr(187),">>")
  1000.   s = replace(s,Chr(188),"1/4")
  1001.   s = replace(s,Chr(189),"1/2")
  1002.   s = replace(s,Chr(190),"3/4")
  1003.   s = replace(s,Chr(191),"?")
  1004.  
  1005.   s = replace(s,Chr(192),"A")
  1006.   s = replace(s,Chr(193),"A")
  1007.   s = replace(s,Chr(194),"A")
  1008.   s = replace(s,Chr(195),"A")
  1009.   s = replace(s,Chr(196),"A")
  1010.   s = replace(s,Chr(197),"A")
  1011.   s = replace(s,Chr(198),"AE")
  1012.   s = replace(s,Chr(199),"C")
  1013.   s = replace(s,Chr(200),"E")
  1014.   s = replace(s,Chr(201),"E")
  1015.   s = replace(s,Chr(202),"E")
  1016.   s = replace(s,Chr(203),"E")
  1017.  
  1018.  
  1019.   s = replace(s,Chr(204),"I")
  1020.   s = replace(s,Chr(205),"I")
  1021.   s = replace(s,Chr(206),"I")
  1022.   s = replace(s,Chr(207),"I")
  1023.  
  1024.   s = replace(s,Chr(208),"D")
  1025.   s = replace(s,Chr(209),"N")
  1026.  
  1027.   s = replace(s,Chr(210),"O")
  1028.   s = replace(s,Chr(211),"O")
  1029.   s = replace(s,Chr(212),"O")
  1030.   s = replace(s,Chr(213),"O")
  1031.   s = replace(s,Chr(214),"O")
  1032.   s = replace(s,Chr(215),"x")
  1033.   s = replace(s,Chr(216),"O")
  1034.  
  1035.   s = replace(s,Chr(217),"U")
  1036.   s = replace(s,Chr(218),"U")
  1037.   s = replace(s,Chr(219),"U")
  1038.   s = replace(s,Chr(220),"U")
  1039.   s = replace(s,Chr(221),"Y")
  1040.  
  1041.   s = replace(s,Chr(222),"")
  1042.  
  1043.   s = replace(s,Chr(223),"ss") '?
  1044.  
  1045.   s = replace(s,Chr(224),"a")
  1046.   s = replace(s,Chr(225),"a")
  1047.   s = replace(s,Chr(226),"a")
  1048.   s = replace(s,Chr(227),"a")
  1049.   s = replace(s,Chr(228),"a")
  1050.   s = replace(s,Chr(229),"a")
  1051.  
  1052.   s = replace(s,Chr(230),"ae")
  1053.   s = replace(s,Chr(231),"c")
  1054.  
  1055.   s = replace(s,Chr(232),"e")
  1056.   s = replace(s,Chr(233),"e")
  1057.   s = replace(s,Chr(234),"e")
  1058.   s = replace(s,Chr(235),"e")
  1059.  
  1060.   s = replace(s,Chr(236),"i")
  1061.   s = replace(s,Chr(237),"i")
  1062.   s = replace(s,Chr(238),"i")
  1063.   s = replace(s,Chr(239),"i")
  1064.   s = replace(s,Chr(240),"a") '?
  1065.  
  1066.   s = replace(s,Chr(241),"n")
  1067.  
  1068.   s = replace(s,Chr(242),"o")
  1069.   s = replace(s,Chr(243),"o")
  1070.   s = replace(s,Chr(244),"o")
  1071.   s = replace(s,Chr(245),"o")
  1072.   s = replace(s,Chr(246),"o")
  1073.   s = replace(s,Chr(247),"")    '?
  1074.   s = replace(s,Chr(248),"o")
  1075.  
  1076.   s = replace(s,Chr(249),"u")
  1077.   s = replace(s,Chr(250),"u")
  1078.   s = replace(s,Chr(251),"u")
  1079.   s = replace(s,Chr(252),"u")
  1080.  
  1081.   s = replace(s,Chr(253),"y")
  1082.   s = replace(s,Chr(254),"") '?
  1083.  
  1084.   filter = replace(s,Chr(34),"''")        'reading songs with " char causes lockup
  1085. End Function
  1086.  
  1087. '------------------ String Pixels calculation -------------
  1088.  
  1089. Function strPix(str,max)            'return #pixels needed to display string and
  1090.   Dim i, pixsize
  1091.  
  1092.   If (Max = -1) Then                'no maximum break
  1093.     For i=1 to Len(str)
  1094.       pixsize = pixsize + pixelsOf(Mid(str,i,1))
  1095.     Next
  1096.  
  1097.   Else                        'with maximum break max <> -1
  1098.     For i=1 to Len(str)
  1099.       pixsize = pixsize + pixelsOf(Mid(str,i,1))
  1100.  
  1101.       If (pixsize > max) Then            'return -1 if max value is passed (overflow)
  1102.         strPix = -1
  1103.         Exit Function
  1104.       End If
  1105.     Next
  1106.   End If
  1107.  
  1108.   strPix = pixsize                'return #pixels needed
  1109. End Function
  1110.  
  1111.  
  1112. Function pixelsOf(c)    'return #pixels needed to display a character
  1113.   If (MyPhoneType(1)<3) Then
  1114.     If (InStr(" il.,!'I|:;_",c)) Then
  1115.       pixelsOf = 3
  1116.       Exit Function
  1117.     ElseIf (InStr("j()[]",c)) Then
  1118.       pixelsOf = 4
  1119.       Exit Function
  1120.     ElseIf (InStr("frt{}-",c)) Then
  1121.       pixelsOf = 5
  1122.       Exit Function
  1123.     ElseIf (InStr("cszZ/1<>=",c)) Then
  1124.       pixelsOf = 6
  1125.       Exit Function
  1126.     'ElseIf (InStr("abdeghknopquxyABCDEFGHJKLOPRSTUY?^$+023456789",c)) then
  1127.       'pixelsOf = 7
  1128.       'Exit Function
  1129.     ElseIf (InStr("vNQVX&0",c)) Then
  1130.       pixelsOf = 8
  1131.       Exit Function
  1132.     ElseIf (InStr("@%",c)) Then
  1133.       pixelsOf = 9
  1134.       Exit Function
  1135.     ElseIf (c="M") Then
  1136.       pixelsOf = 10
  1137.       Exit Function
  1138.     ElseIf (InStr("mwW",c)) Then
  1139.       pixelsOf = 11
  1140.       Exit Function
  1141.     Else
  1142.       pixelsOf = 7    'unicode cases
  1143.     End If
  1144.   Else
  1145.     If (InStr("iIl!.'|",c)) Then
  1146.       pixelsOf = 2
  1147.       Exit Function
  1148.     ElseIf (InStr(" fjt():,[];",c)) Then
  1149.       pixelsOf = 3
  1150.       Exit Function
  1151.     ElseIf (InStr("r-/{}",c)) Then
  1152.       pixelsOf = 4
  1153.       Exit Function
  1154.     ElseIf (InStr("cksxzJ_",c)) Then
  1155.       pixelsOf = 5
  1156.       Exit Function
  1157.     'ElseIf (InStr("aαßΓπΣσeΦΘΩδo≥≤⌠⌡÷u∙·√ⁿybdghnpqvEBFLSTZ*0123456789?&^+=<>",c)) Then
  1158.       'pixelsOf = 6
  1159.       'Exit Function
  1160.     ElseIf (InStr("OUCDGHKNPRQ~",c)) Then
  1161.       pixelsOf = 7
  1162.       Exit Function
  1163.     ElseIf(InStr("mwAMYVXM%",c)) Then
  1164.       pixelsOf = 8
  1165.       Exit Function
  1166.     ElseIf (InStr("@#",c)) Then
  1167.       pixelsOf = 9
  1168.       Exit Function
  1169.     ElseIf (c="W") Then
  1170.       pixelsOf = 10
  1171.       Exit Function
  1172.     Else
  1173.       pixelsOf = 6    'unicode cases
  1174.     End If
  1175.   End If
  1176. End Function
  1177.  
  1178. '------------------ String Pixels calculation -------------
  1179.  
  1180. Function ShowPixsOfStr(s,x)            'trims down a string to max (x) pixels
  1181.   Dim i, pixsize, w
  1182.   'Width = ScreenWidth-13        'width available pixels T610:112 t68i = 94
  1183.   w = ScreenWidth-x            'width available pixels T610:112 t68i = 94
  1184.  
  1185.   For i=1 to Len(s)                    'for part to determine last char that fits onto screen
  1186.     pixsize = pixsize + pixelsOf(Mid(s,i,1))
  1187.  
  1188.     If (pixsize > w) Then
  1189.       ShowPixsOfStr = Left(s,i-1)
  1190.       Exit Function
  1191.     End If
  1192.   Next
  1193.   ShowPixsOfStr = s
  1194. End Function
  1195.  
  1196. '------------------ center functions ----------------------
  1197.  
  1198. Function center(Str,char)        'center str with char sign on left and right side
  1199.   Dim i, r, s, pixs, p
  1200.   pixs = strPix(str,ScreenWidth)    'count pixs of string with maximum of screenwidth
  1201.   i = 0
  1202.   If (pixs = -1) Then        'if #str is larger dan screenwidth  (overflow)
  1203.     center = str
  1204.     Exit Function
  1205.  
  1206.   Else
  1207.     r = ScreenWidth - pixs    'remaining pixels
  1208.  
  1209.     If (char = "") Then
  1210.       s = (ScreenWidth - pixs)\6        'determine number of spaces at left side (remaining pixels div. by 2*3 space pixels)
  1211.       center = Space(s) & Str
  1212.       Exit Function
  1213.     Else
  1214.       p = 2*pixelsOf(char)
  1215.  
  1216.       i = r\p
  1217.       s = (r - i*p)\6
  1218.     End If
  1219.   End If
  1220.   center = Space(s) & String(i,char) & str & String(i,char)
  1221. End Function
  1222.  
  1223.  
  1224. '------------------ about --------------------------
  1225. Sub about()
  1226.   CurrentID = "about"
  1227.  
  1228.   Dim title, text, text1, text2, text3, text4
  1229.   title = "about"
  1230.  
  1231.   If (MyPhoneType(1)<3) Then
  1232.     text1 = "CarpeDi3m1687 v" & ScriptVersion
  1233.     text2 = "        by CarpeDi3m      "
  1234.     text3 = Space(38)
  1235.   Else
  1236.     text1 = "CarpeDi3m1687 " & ScriptVersion
  1237.     text2 = "      by CarpeDi3m      "
  1238.     text3 = Space(34)
  1239.   End If
  1240.   text4 = "Contributors: daveo, skyw33, HRS, Vit Ondruch, mhr, nossenigma, hazart, eMBee"
  1241. ' all should be mentioned, no?
  1242.  
  1243.   text = text1 & text2 & text3 & text4
  1244.  
  1245.   am.NextState = 2
  1246.   am.DlgInformation title, text
  1247.   am.back = "onAMRoot"
  1248. End Sub
  1249.  
  1250.  
  1251. '----------------- end about ----------------------
  1252.  
  1253. '------------------ browse and playlist -------------------
  1254. Public IsRoot
  1255.  
  1256. Public BrowsePath
  1257. Public BrowseFilesArray
  1258. Public FilesOnPage
  1259. Public BrowsePage
  1260.  
  1261. Public BeginShow
  1262. Public EndShow
  1263.  
  1264. Public BeginDrives
  1265. BeginDrives = 3
  1266. Public EndDrives
  1267.  
  1268. Public BeginFolders
  1269. Public EndFolders
  1270.  
  1271. Public BeginFiles
  1272. Public EndFiles
  1273.  
  1274. Public BrowseType
  1275.  
  1276. FilesOnPage = 6
  1277.  
  1278. Sub enterBrowse
  1279.   setGotoMethod("enterBrowse")
  1280.   enterAppMenu(14)
  1281.   CurrentItem = "browse"
  1282.  
  1283.   BrowseType = "FoldersFiles"
  1284.   BrowsePath = "C:\"
  1285.   BrowsePage = 0
  1286.  
  1287.   browse
  1288. End Sub
  1289.  
  1290. Sub browse
  1291.   Dim oFolder, oSubFolder, oSubFolders,oFiles, oFile, oDrives, oDrive, oParentFolder, i, FileTempString
  1292.   Set oDrives = Fso.Drives
  1293.  
  1294.   Set oFolder = Fso.GetFolder(BrowsePath)
  1295.   Set oSubFolders = oFolder.SubFolders
  1296.   Set oFiles = oFolder.files
  1297.   Set oParentFolder = oFolder.ParentFolder
  1298.  
  1299.   ReDim BrowseFilesArray(oDrives.Count+oSubFolders.Count+oFiles.Count+3,2)    '+3 for current drive, parrent folder, current folder name
  1300. 'setting up array
  1301.  
  1302.   BrowseFilesArray(0,0) = "<" & Fso.GetDriveName(oFolder.Path) & ">"    'current drive
  1303.   BrowseFilesArray(0,1) = Fso.GetDriveName(oFolder.Path)        'current drive
  1304.  
  1305.   If (oFolder.IsRootFolder) Then                'parent folder
  1306.       IsRoot = TRUE
  1307.     BrowseFilesArray(1,0) = Fso.GetDriveName(oFolder.Path)    'current drive
  1308.     BrowseFilesArray(1,1) = Fso.GetDriveName(oFolder.Path)
  1309.     BrowseFilesArray(2,0) = Fso.GetDriveName(oFolder.Path)
  1310.   Else
  1311.     IsRoot = FALSE
  1312.     BrowseFilesArray(1,0) = oParentFolder.Name
  1313.     BrowseFilesArray(1,1) = oParentFolder.Path
  1314.     BrowseFilesArray(2,0) = Left(oFolder.Name,15)    'current folder name
  1315.   End If
  1316.   BrowseFilesArray(2,1) = oFolder.Path        'current folder path
  1317.  
  1318.   Dim TempVolumeName
  1319.   i=3                        'drive letters
  1320.   For Each oDrive in oDrives
  1321.     Select Case oDrive.DriveType
  1322.       Case 1
  1323.         TempVolumeName = "- Removable"
  1324.       Case 2
  1325.         TempVolumeName = " <" & filter(oDrive.VolumeName) & ">"
  1326.       Case 4
  1327.         TempVolumeName = "- CDROM"
  1328.     End Select
  1329.  
  1330.     BrowseFilesArray(i,0) = filter(oDrive.DriveLetter) & ": " & TempVolumeName  'name
  1331.     BrowseFilesArray(i,1) = oDrive.DriveLetter & ":\"            'logical notation
  1332.     i=i+1
  1333.   Next
  1334.   EndDrives = i-1
  1335.  
  1336.   BeginFolders = i
  1337.   For Each oSubFolder in oSubFolders
  1338.     BrowseFilesArray(i,0) = "[" & filter(oSubFolder.name) & "]"
  1339.     BrowseFilesArray(i,1) = oSubFolder.path
  1340.     i=i+1
  1341.   Next
  1342.   EndFolders = i-1
  1343.  
  1344.   BeginFiles = i
  1345.  
  1346.  
  1347.   For Each oFile in oFiles
  1348.     FileTempString = filter(oFile.name)
  1349.  
  1350.     If (CurrentItem = "selectPlaylist") Then
  1351.  
  1352.       If ((InStr(LCase(FileTempString),".m3u")) Or (InStr(LCase(FileTempString),".pls")))  Then    'show only files with extensions that are linked
  1353.         BrowseFilesArray(i,0) = FileTempString
  1354.         BrowseFilesArray(i,1) = oFile.path
  1355.         i=i+1
  1356.       End If
  1357.     Else
  1358.       BrowseFilesArray(i,0) = FileTempString
  1359.       BrowseFilesArray(i,1) = oFile.path
  1360.       i=i+1
  1361.     End If
  1362.   Next
  1363.  
  1364.   EndFiles = i-1
  1365.  
  1366.   If ((BeginFolders>EndFolders) And (BeginFiles>EndFiles)) Then
  1367.     If (CurrentItem = "selectPlaylist") Then
  1368.       BrowseFilesArray(i,0) = "Empty"
  1369.     Else
  1370.       BrowseFilesArray(i,0) = ".."
  1371.     End If
  1372.     BrowseFilesArray(i,1) = "empty"
  1373.     EndFiles = BeginFiles
  1374.   End If
  1375.  
  1376.   Select Case CurrentItem
  1377.     Case "selectPlaylist"  browsePlaylistShow
  1378.     Case Else  browseFoldersFiles
  1379.   End Select
  1380. End Sub
  1381.  
  1382. Sub RunFile(f)
  1383.   Shell.Run "RunDLL32.EXE shell32.dll,ShellExec_RunDLL """ & f & """"
  1384.   browseShow
  1385. End Sub
  1386.  
  1387. Sub OpenPlaylist(f)
  1388.   shell.Exec RootEXE(2) & " " & Chr(34) & f & Chr(34) 'winamp
  1389.   GetPlaylistBool = TRUE
  1390.   GetPlaylist
  1391.   enterWinamp
  1392. End Sub
  1393.  
  1394. Sub browseShow
  1395.   am.Clear
  1396.   If (BrowseType="Drives") Then
  1397.       am.Title = Left("Drives [" & CStr(BrowsePage+1) & "/" & CStr( ((EndShow-BeginShow)\FilesOnPage) +1) & "]", 15)
  1398.     am.Back = "onAMRoot"
  1399.   ElseIf (CurrentItem = "selectPlaylist") Then
  1400.     am.Title = Left("Playlists [" & CStr(BrowsePage+1) & "/" & CStr( ((EndShow-BeginShow)\FilesOnPage) +1) & "]",15)
  1401.     am.Back = "enterWinamp"
  1402.   Else
  1403.    'am.Title = BrowseType & " [" & CStr(BrowsePage+1) & "/" & CStr( ((EndShow-BeginShow)\FilesOnPage) +1) & "]"
  1404.     am.Title = Left(BrowseFilesArray(2,0),15)
  1405.     am.Back = "onAMRoot"
  1406.   End If
  1407.  
  1408.   setItemPress("clickOnFile")
  1409.  
  1410.   Dim i,j
  1411.   Dim TempStr
  1412.   For i=0 to FilesOnPage-1
  1413.     j = BrowsePage*FilesOnPage + BeginShow + i
  1414.     If (j <= EndShow) Then
  1415.       If (CurrentItem = "selectPlaylist") Then
  1416.         TempStr = BrowseFilesArray(j,0)
  1417.           If (BrowseFilesArray(j,1)="empty") Then
  1418.           am.AddItem TempStr, "itemPress" & i
  1419.         Else
  1420.         am.AddItem Left(TempStr,Len(TempStr)-4), "itemPress" & i
  1421.         End If
  1422.       Else
  1423.         am.AddItem BrowseFilesArray(j,0), "itemPress" & i
  1424.       End If
  1425.     Else
  1426.       Exit For
  1427.     End If
  1428.   Next
  1429.  
  1430.   am.NextState = 2
  1431.   am.Update
  1432. End Sub
  1433.  
  1434. Sub browseOption
  1435.    Dim TempFiles, TempPage
  1436.   CurrentItem = "browseOption"
  1437.  
  1438.    TempPage = CStr(BrowsePage+1) & "/" & CStr( ((EndShow-BeginShow)\FilesOnPage) +1)
  1439.    If (BrowseType="Drives") Then
  1440.      am.DlgInformation "Browse Info", "Page: " & TempPage & "     Drives: " & CStr(EndDrives - BeginDrives +1)
  1441.    Else
  1442.      If(BrowseFilesArray(BeginFiles,1)="empty") Then
  1443.        TempFiles = "0"
  1444.      Else
  1445.        TempFiles = CStr(EndFiles - BeginFiles +1)
  1446.      End If
  1447.      am.DlgInformation "view", "Page: " & TempPage & Space(10) & "Folders: " & CStr(EndFolders - BeginFolders +1) & "   Files: " & TempFiles & "    " & Replace(BrowsePath, "\", "\\") & Space(10)
  1448.    End If
  1449.  
  1450.   am.NextState = 2
  1451.   am.Back = "exitBrowseOption"
  1452. End Sub
  1453.  
  1454. Sub exitBrowseOption
  1455.   CurrentItem = "browse"
  1456.   browseShow
  1457. End Sub
  1458.  
  1459. Sub browsePlaylistShow
  1460.   BeginShow = BeginFiles
  1461.   EndShow = EndFiles
  1462.   browseShow
  1463. End Sub
  1464.  
  1465. Sub browsePlaylist
  1466.   setGotoMethod("browsePlaylist")
  1467.  
  1468.   CurrentItem = "selectPlaylist"
  1469.   deleteTimers
  1470.   BrowsePage = 0
  1471.   BrowsePath = PlaylistPath
  1472.   browse
  1473. End Sub
  1474.  
  1475. Sub browseDrives
  1476.   BrowsePage = 0
  1477.   BrowseType = "Drives"
  1478.   BeginShow = BeginDrives
  1479.   EndShow = EndDrives
  1480.   browseShow
  1481. End Sub
  1482. Sub browseFoldersFiles
  1483.   BrowsePage = 0
  1484.   BrowseType = "FoldersFiles"
  1485.   BeginShow = BeginFolders
  1486.   EndShow = EndFiles
  1487.   browseShow
  1488. End Sub
  1489. Sub browseFolders
  1490.   BrowsePage = 0
  1491.   BrowseType = "Folders"
  1492.   BeginShow = BeginFolders
  1493.   EndShow = EndFolders
  1494.   browseShow
  1495. End Sub
  1496. Sub browseFiles
  1497.   BrowsePage = 0
  1498.   BrowseType = "Files"
  1499.   BeginShow = BeginFiles
  1500.   EndShow = EndFiles
  1501.   browseShow
  1502. End Sub
  1503.  
  1504. Sub clickOnFile(i)
  1505.   Dim i2, p
  1506.   i2 = BrowsePage*FilesOnPage + BeginShow + i
  1507.   p = BrowseFilesArray(i2,1)
  1508.   If ((i2 >= BeginFiles) And (i2 <= EndFiles)) Then
  1509.     If (p="empty") Then
  1510.       If (CurrentItem = "selectPlaylist") Then
  1511.           enterWinamp
  1512.         Else
  1513.         browseUp
  1514.         End If
  1515.     Else
  1516.     am.DlgFeedBack "Opening.. ", "browseShow"
  1517.     am.update
  1518.     If (CurrentItem = "selectPlaylist") Then
  1519.       OpenPlaylist(p)
  1520.     Else
  1521.       RunFile(p)
  1522.     End If
  1523.     End If
  1524.   Else
  1525.     BrowsePath = p
  1526.     am.Clear
  1527.     browse
  1528.   End If
  1529. End Sub
  1530.  
  1531. Sub BrowseUp
  1532.   BrowsePage = 0
  1533.   BrowsePath = BrowseFilesArray(1,1)
  1534.   browse
  1535. End Sub
  1536.  
  1537. Sub nextBrowse
  1538.   Dim i
  1539.   i = (EndShow-BeginShow)\FilesOnPage
  1540.   If (i>0) Then
  1541.     If (BrowsePage = i) Then
  1542.       BrowsePage = 0
  1543.     Else
  1544.       BrowsePage = BrowsePage+1
  1545.     End If
  1546.     browseShow
  1547.   End If
  1548. End Sub
  1549.  
  1550. Sub prevBrowse
  1551.   Dim i
  1552.   i = (EndShow-BeginShow)\FilesOnPage
  1553.   If (i>0) Then
  1554.     If (BrowsePage = 0) Then
  1555.       BrowsePage = i
  1556.     Else
  1557.       BrowsePage = BrowsePage-1
  1558.     End If
  1559.     browseShow
  1560.   End If
  1561. End Sub
  1562.  
  1563. '------------------ end browse and playlist --------------
  1564.  
  1565. '-------------------Winamp Control (made by CarpeDi3m1687 version 2.0a)---------
  1566.  
  1567. Public Pos        'passing of track position
  1568.  
  1569. '------------------ Winamp main menu ----------------------
  1570. 'id=2
  1571.  
  1572. Sub enterWinamp()
  1573.   setGotoMethod("enterWinamp")
  1574.  
  1575.   If (Not WinampCtrl.WinampState) Then
  1576.     LaunchAppDlg
  1577.     WinampCtrl.WinampState = TRUE
  1578.   End If
  1579.  
  1580.   UseSearchPlayList = FALSE
  1581.   SimpleSearchOn = FALSE
  1582.  
  1583.   am.Clear
  1584.  
  1585.   getPlayList
  1586.  
  1587.   winamp
  1588. End Sub
  1589.  
  1590. Public SavePlayListLength
  1591. Public SavePlayListPos
  1592. Public SaveSongState
  1593. Public SaveWinampState
  1594.  
  1595. Sub winampUpdate
  1596.   If (SavePlayListLength <> WinampCtrl.GetPlayListLength) Then
  1597.     reloadPlaylist
  1598.   ElseIf (SavePlayListPos<>WinampCtrl.GetPlayListPosition) or (SaveSongState<>WinampCtrl.GetSongState) Then
  1599.     winamp
  1600.   End If
  1601. End Sub
  1602. Sub winamp()
  1603.   deleteTimers
  1604.   enterAppMenu(2)
  1605.  
  1606.   If WinampCtrl.WinampState Then
  1607.     SavePlayListPos = WinampCtrl.GetPlayListPosition
  1608.     fma.AddTimer 4000, "winampUpdate"
  1609.     If (WinampCtrl.GetPlayListLength > 0) Then        'not empty playlist
  1610.        SaveSongState = WinampCtrl.GetSongState
  1611.  
  1612.        Select Case SaveSongState
  1613.          Case "Playing"
  1614.            am.AddItem "> " & songTitle(SavePlayListPos-1,-ScreenWidth), "enterPlayList"
  1615.          Case "Stopped"
  1616.            am.AddItem "[ ] " & songTitle(SavePlayListPos-1,-ScreenWidth), "enterPlayList"
  1617.          Case "Paused"
  1618.            am.AddItem "| | " & songTitle(SavePlayListPos-1,-ScreenWidth), "enterPlayList"
  1619.        End Select
  1620.  
  1621.        am.AddItem "Search", "Winampsearch"
  1622.        am.AddItem "Seek", "enterSeek"
  1623.  
  1624.        Select Case SaveSongState            'play
  1625.          Case "Playing"
  1626.            am.AddItem "Restart", "winampPlay"
  1627.          Case "Stopped"
  1628.            am.AddItem "Play", "winampPlay"
  1629.          Case "Paused"
  1630.            am.AddItem "Stop", "winampStop"
  1631.        End Select
  1632.  
  1633.        Select Case SaveSongState        'pause
  1634.          Case "Playing"
  1635.            am.AddItem "Pause", "winampPause"
  1636.          Case "Stopped"
  1637.            am.AddItem "-", "winampPlay"
  1638.          Case "Paused"
  1639.            am.AddItem "Resume", "winampPause"
  1640.        End Select
  1641.      am.Title = Left(SaveSongState & " #" & SavePlayListPos,15)
  1642.      Else
  1643.        am.Title = "Empty playlist"
  1644.      End If
  1645.  
  1646.      am.AddItem "Playlists", "browsePlaylist"
  1647.      am.AddItem "Close Winamp", "winampClose"
  1648.   Else
  1649.     am.Title = "Winamp"
  1650.     am.AddItem "Launch Winamp", "winampLaunch"
  1651.   End If
  1652.   am.Back = "exitWinamp"
  1653.   am.NextState=2
  1654.   am.Update
  1655. End Sub
  1656. Sub exitWinamp
  1657.   deleteTimers
  1658.   onAMRoot
  1659. End Sub
  1660.  
  1661. Sub winampLaunch()
  1662.   CurrentItem = "LaunchWinamp"
  1663.   LaunchAppDlg
  1664.   WinampCtrl.WinampState = TRUE
  1665.   UseSearchPlaylist = FALSE
  1666.   winamp
  1667. End Sub
  1668.  
  1669. Sub winampClose()
  1670.   CurrentItem = "CloseWinamp"
  1671.   CloseAppDlg
  1672.   WinampCtrl.WinampState = FALSE
  1673.   winamp
  1674. End Sub
  1675.  
  1676. Sub winampPlay()
  1677.   WinampCtrl.Play
  1678.   winamp
  1679. End Sub
  1680. Sub winampPause()
  1681.   WinampCtrl.Pause
  1682.   winamp
  1683. End Sub
  1684. Sub winampStop()
  1685.   WinampCtrl.Stop
  1686.   winamp
  1687. End Sub
  1688. Sub winampPrevSong()
  1689.   If (UseSearchPlaylist) Then
  1690.     If(Pos=0) Then
  1691.       Pos=UBound(PlayListArray)
  1692.     Else
  1693.       Pos=Pos-1
  1694.     End If
  1695.     WinampCtrl.PlaySongByPosition(PlayListArray(Pos))
  1696.   Else
  1697.     WinampCtrl.PreviousTrack
  1698.   End If
  1699.   winamp
  1700. End Sub
  1701.  
  1702. Sub winampNextSong()
  1703.   If (UseSearchPlaylist) Then
  1704.     If(Pos<UBound(PlayListArray)) Then        'if not equal or greater then
  1705.       Pos=Pos+1
  1706.     Else
  1707.       Pos=0
  1708.     End If
  1709.     WinampCtrl.PlaySongByPosition(PlayListArray(Pos))
  1710.   Else
  1711.     WinampCtrl.NextTrack
  1712.   End If
  1713.   winamp
  1714. End Sub
  1715.  
  1716. Public UseSearchPlaylist
  1717.  
  1718. Sub getPlayList
  1719.   If (GetPlayListBool) Then
  1720.     am.Clear
  1721.     am.DlgFeedBack "Loading...","onAMRoot"
  1722.     am.title ="Loading..."
  1723.     am.AddItem "Cancel","onAmRoot"
  1724.     am.back = "enterWinamp"
  1725.     am.Update
  1726.  
  1727.     GetPlayListBool = FALSE
  1728.  
  1729.     WinampCtrl.GetPlayList
  1730.     SavePlayListLength = WinampCtrl.GetPlayListLength
  1731.   End If
  1732. End Sub
  1733.  
  1734. '------------------ playlist ------------------------------
  1735.  
  1736. Sub enterPlayList()
  1737.   If (WinampCtrl.GetPlayListLength > 0) Then        'Playlist is not empty
  1738.     If(Not UseSearchPlayList) Then            'Pos is set on search?????
  1739.       Pos = (WinampCtrl.GetPlayListPosition - 1)
  1740.     End If
  1741.     playList(Pos)
  1742.     SavePlayListPos = WinampCtrl.GetPlayListPosition
  1743.   Else
  1744.     am.Update
  1745.   End If
  1746. End Sub
  1747.  
  1748. Sub playlistUpdate
  1749.   If (SavePlayListLength <> WinampCtrl.GetPlayListLength) Then
  1750.     reloadPlaylist
  1751.   ElseIf (SavePlayListPos<>WinampCtrl.GetPlayListPosition) or (SaveSongState<>WinampCtrl.GetSongState) Then    'playing song or state song changed
  1752.     If ((Pos<CInt(SavePlayListPos)) and (CInt(SavePlayListPos)<=(Pos+NrSongsOnPage))) Then
  1753.         playlist(WinampCtrl.GetPlayListPosition-1)    'only if playing song is shown
  1754.     End If
  1755.   End If
  1756. End Sub
  1757.  
  1758. Sub playList(p)            'first track on list is p=0
  1759.   Dim i
  1760.   deleteTimers
  1761.   SavePlayListPos = WinampCtrl.GetPlayListPosition
  1762.   setGotoMethod("playList")
  1763.   CurrentItem = "playlist"
  1764.   LastArg1 = p
  1765.  
  1766.   am.Clear
  1767.   If (UseSearchPlayList) Then
  1768.     am.Title = Left("Search: " & CStr(p+1),15)
  1769.   Else
  1770.     am.Title = Left("Playlist: " & CStr(p+1),15)
  1771.     fma.AddTimer 4000, "playlistUpdate"
  1772.   End If
  1773.  
  1774.   Pos = p                'var needed to pass to: prevPlayList, nextPlayList, playSongs(1..9)
  1775.  
  1776.   setItemPress("clickOnSong")
  1777.   For i=0 to NrSongsOnPage-1
  1778.     If ( p+i < getTotalSongs) Then            'while there are still songs to be shown
  1779.       am.AddItem getSong(getIndex(p+i)), "itemPress" & i
  1780.     Else                    'no songs to be shonwn
  1781.       Exit For
  1782.     End If
  1783.   Next
  1784.  
  1785.   am.Back = "exitPlayList"
  1786.   am.NextState=2
  1787.   am.Update
  1788. End Sub
  1789.  
  1790. Sub exitPlayList
  1791.   If (UseSearchPlaylist) Then
  1792.     SimpleSearchOn = SimpleSearchOnBackup
  1793.     Select Case SearchType
  1794.       Case "artist"
  1795.         artistResults
  1796.       Case "title"
  1797.         titleResults
  1798.       Case Else
  1799.         allArtists
  1800.     End Select
  1801.   Else
  1802.     enterWinamp
  1803.   End If
  1804. End Sub
  1805.  
  1806. Sub clickOnSong(index)
  1807.   Dim i, b, j
  1808.   i = Pos + index
  1809.   j = getIndex(i)
  1810.  
  1811.   If ((WinampCtrl.GetSongState = "Playing") And (WinampCtrl.GetPlayListPosition-1=j) ) Then            'clicked on a song that is being played then show song info
  1812.     SavePlaylistPos = WinampCtrl.GetPlayListPosition
  1813.     songInfo(j)
  1814.   Else                        'if song is not being played
  1815.     WinampCtrl.PlaySongByPosition(j)        'index choose function
  1816.     playList(i)                    'show playlist with song# i at top of list
  1817.   End If
  1818. End Sub
  1819.  
  1820. Sub songInfoUpdate
  1821.   If (SavePlayListPos = WinampCtrl.GetPlayListPosition) Then    'same song played
  1822.     am.Title = Left("( " & WinampCtrl.GetSongPosition & " )",15)
  1823.     am.update
  1824.   Else                                'show new song info
  1825.     deleteTimers    'not needed
  1826.     songInfo(WinampCtrl.GetPlayListPosition-1)
  1827.   End If
  1828. End Sub
  1829.  
  1830. Public PlayListArray        'Dynamic array with TrackIndexes
  1831.  
  1832. Function getIndex(i)
  1833.   If (UseSearchPlaylist) Then
  1834.     getIndex = PlayListArray(i)
  1835.   Else
  1836.     getIndex = i
  1837.   End If
  1838. End Function
  1839.  
  1840. Function getTotalSongs()
  1841.   If (UseSearchPlaylist) Then
  1842.     getTotalSongs = UBound(PlayListArray)+1
  1843.   Else
  1844.     getTotalSongs = CInt(WinampCtrl.GetPlayListLength)
  1845.   End If
  1846. End Function
  1847.  
  1848.  
  1849. Sub prevPlayList()
  1850.   If (getTotalSongs>NrSongsOnPage) Then
  1851.     If (Pos>NrSongsOnPage-1) Then        'not first page
  1852.       Pos = Pos - NrSongsOnPage
  1853.     ElseIf (Pos=0) Then                'first page with first song of complete playlist
  1854.       Pos = getTotalSongs - NrSongsOnPage
  1855.     Else                    '0 < Pos < NrSongsOnPage
  1856.       Pos = 0
  1857.     End If
  1858.   Else
  1859.     Pos = 0
  1860.   End If
  1861.  
  1862.   playList(Pos)                'Show new playlist with song# (Pos) as top of the list
  1863. End Sub
  1864.  
  1865. Sub nextPlayList()
  1866.   Pos = Pos+NrSongsOnPage
  1867.  
  1868.   If (Pos > getTotalSongs-1) Then        'last page
  1869.     Pos = 0
  1870.   End If
  1871.  
  1872.   playList(Pos)        'Show new playlist with song# (Pos) as top of the list
  1873. End Sub
  1874.  
  1875. Function getSong(p)                'return songtitle of song p
  1876.   Dim mark, i
  1877.   If (WinampCtrl.GetPlayListPosition-1 = p) Then    'if P is current song being played
  1878.     Select Case WinampCtrl.GetSongState
  1879.       Case "Playing"
  1880.         getSong = "> " & songTitle(p,6)
  1881.       Case "Paused"
  1882.         getSong = "| | " & songTitle(p,6)
  1883.       Case Else
  1884.         getSong = "[] " & songTitle(p,6)
  1885.     End Select
  1886.  
  1887.     Exit Function
  1888.   ElseIf (simpleSearchOn) Then
  1889.     mark = " "
  1890.     For i=0 to SearchResult-1
  1891.       If (WinampCtrl.GetSearchSong(i)=p) Then
  1892.         mark = "- "
  1893.         Exit For
  1894.       End If
  1895.     Next
  1896.   Else    'no simplesearch
  1897.     mark = " "
  1898.   End If
  1899.   getSong = mark & songTitle(p,2)
  1900.  
  1901. '  getSong = mark & songTitle(p,13)
  1902. End Function
  1903.  
  1904. Function songTitle(p,x)
  1905.   Dim s
  1906.   s = filter(WinampCtrl.GetSongTitlebyPosition(p))
  1907.  
  1908.   s = replace(s,"( ","(")
  1909.   s = replace(s," )",")")
  1910.   s = replace(s,"[ ","[")
  1911.   s = replace(s," ]","]")
  1912.  
  1913.   songTitle = showPixsOfStr(s,x)
  1914. End Function
  1915.  
  1916. '------------------ Playlist ------------------------------
  1917.  
  1918.  
  1919. 'GetFileNamebyPosition[Position: Integer]: String read
  1920. '   returns the name of file in a determinated position in playlist
  1921.  
  1922. 'StartOfPlayList
  1923. 'FadeOutStop
  1924.  
  1925. '------------------ songInfo ------------------------------
  1926.  
  1927. Function invertGetIndex(i)
  1928.   Dim j
  1929.   If (UseSearchPlayList) Then
  1930.     For j=0 to UBound(PlayListArray)
  1931.       If (PlayListArray(j)=i) Then
  1932.           invertGetIndex = j
  1933.           Exit Function
  1934.       End If
  1935.     Next
  1936.   Else
  1937.     invertGetIndex = i
  1938.   End If
  1939. End Function
  1940.  
  1941. Sub songInfo(i)                            'show song info of song# i
  1942.   Dim arrSong, arrArtist, tempArr
  1943.   Dim artist, song, track, length, line1, line2, line3, line4, line5, line6, line7
  1944.  
  1945.   setGotoMethod("songInfo")
  1946.   CurrentItem = "songInfo"
  1947.   deleteTimers
  1948.   fma.AddTimer 2250, "songInfoUpdate"
  1949.   LastArg1 = i
  1950.  
  1951.   WinampCtrl.SongPosParseTime = TRUE
  1952.   WinampCtrl.SetLengthParseTime = TRUE                'sets return of WinampCtrl.GetSongLength to (h:m:s)
  1953.  
  1954.   song = Filter(WinampCtrl.GetSongTitleByPosition(i))
  1955.   artist = Filter(WinampCtrl.GetArtistByPosition(i))
  1956.  
  1957.   track = " [ " & invertGetIndex(i)+1 & " of " & getTotalSongs & " ] "
  1958.   length = " ( " & WinampCtrl.GetSongLength & " ) "
  1959.  
  1960.   arrSong = splitString(song)
  1961.   arrArtist = splitString(artist)
  1962.  
  1963.   line1 = center(track,"-")
  1964.   line2 = center(arrSong(0),"")
  1965.   line3 = center(arrSong(1),"")
  1966.   line4 = center("-","")
  1967.   line5 = center(arrArtist(0),"")
  1968.   line6 = center(arrArtist(1),"")
  1969.  
  1970.   If (arrSong(1) = "") Then
  1971.     If (arrArtist(1) = "") Then
  1972.       line3 = line2
  1973.       line2 = ""
  1974.  
  1975.     ElseIf ( strPix(arrArtist(1),ScreenWidth) = -1 ) Then
  1976.       tempArr = splitString(arrArtist(1))
  1977.  
  1978.       line3 = line4
  1979.       line4 = line5
  1980.       line5 = center(tempArr(0),"")
  1981.       line6 = center(tempArr(1),"")
  1982.     End If
  1983.  
  1984.   ElseIf ( (strPix(arrSong(1),ScreenWidth) = -1) And (arrArtist(1) = "") ) Then
  1985.     tempArr = splitString(arrSong(1))
  1986.  
  1987.     line6 = line5
  1988.     line5 = line4
  1989.     line3 = center(tempArr(0),"")
  1990.     line4 = center(tempArr(1),"")
  1991.   End If
  1992.  
  1993.   line7 = center(length,"-")
  1994.  
  1995.   If (MyPhoneType(1)<3) Then
  1996.     boxT610 line1 ,line2 ,line3 ,line4 ,line5 ,line6 ,line7
  1997.   Else
  1998.     boxT68i line1 ,line2 ,line3 ,line4 ,line5 ,line6 ,line7
  1999.   End If
  2000.  
  2001.   am.NextState=2
  2002.   am.Back = "exitSongInfo"
  2003. End Sub
  2004.  
  2005. Sub songInfo2()                            'show song info of song#
  2006.   setGotoMethod("songInfo2")
  2007.   am.Clear
  2008.   am.Title = Left("( " & WinampCtrl.GetSongPosition & " )",15)
  2009.  
  2010.   CurrentItem = "songInfo2"
  2011.  
  2012.   am.AddItem center("Samplerate: " & WinampCtrl.GetSongSampleRate & "kHz",""), "enterPlayList"
  2013.   am.AddItem center("Bitrate: " & WinampCtrl.GetSongBitRate & "kbps",""), "enterPlayList"
  2014.   am.AddItem center(songChanel,""), "enterPlayList"
  2015.  
  2016.   am.Back = "exitSongInfo"
  2017.   am.NextState=2
  2018.   am.update
  2019. End Sub
  2020.  
  2021. Function songChanel()
  2022.   If (WinampCtrl.GetSongChanel = 1) Then
  2023.     songChanel = "mono"
  2024.   Else
  2025.     songChanel = "stereo"
  2026.   End If
  2027. End Function
  2028.  
  2029. Function splitString(s)        'split string into two parts and return an Array with 2 elements (#chars of first element <= width)
  2030.   Dim s1, s2, w, pixsize, lw, words, break, temps
  2031.   pixsize = 0
  2032.  
  2033.   break = FALSE
  2034.   words = split(s)
  2035.  
  2036.   For Each w In words
  2037.     If (break) Then            'build up string 2
  2038.       s2 = s2 & w & " "
  2039.  
  2040.     Else
  2041.       lw = strPix(w,-1)            'count pix of word
  2042.         If (pixsize + lw > ScreenWidth) Then    'condition that determines border between string 1 and string 2
  2043.           break = TRUE
  2044.           s2 = s2 & w & " "        'word belongs to string 2
  2045.         Else
  2046.           s1 = s1 & w & " "
  2047.           pixsize = pixsize + lw + 3
  2048.         End If
  2049.     End If
  2050.   Next
  2051.  
  2052.   splitString = Array(RTrim(s1),RTrim(s2))
  2053. End Function
  2054.  
  2055.  
  2056. '------------------ SongInfo screen -----------------------
  2057.  
  2058. Sub boxT68i(line1,line2,line3,line4,line5,line6,line7)    'function needed for songinfo function (opens new window)
  2059.   am.Clear
  2060.   am.Title = Left("( " & WinampCtrl.GetSongPosition & " )",15)
  2061.   am.AddItem line1, "exitSongInfo"
  2062.   am.AddItem line2, "exitSongInfo"
  2063.   am.AddItem line3, "exitSongInfo"
  2064.   am.AddItem line4, "exitSongInfo"
  2065.   am.AddItem line5, "exitSongInfo"
  2066.   am.AddItem line6, "exitSongInfo"
  2067.   am.AddItem line7, "exitSongInfo"
  2068.   am.NextState=2
  2069.   am.Update
  2070. End Sub
  2071.  
  2072.  
  2073. Sub boxT610(line1,line2,line3,line4,line5,line6,line7)    'function needed for songinfo function (opens new window)
  2074.   Dim SongOneLine
  2075.   Dim ArtistOneLine
  2076.  
  2077.   am.Clear
  2078.   am.Title = Left("( " & WinampCtrl.GetSongPosition & " )",15)
  2079.   am.AddItem line1, "exitSongInfo"
  2080.  
  2081.   SongOneLine = (Trim(line2) = "") Or (Trim(line3) = "")
  2082.   ArtistOneLine = (Trim(line6) = "")
  2083.  
  2084.   If ((Not SongOneLine) Or ArtistOneLine) Then    'song multiple lines
  2085.     am.AddItem line2, "exitSongInfo"
  2086.   Else
  2087.     Line3 = line2
  2088.   End If
  2089.  
  2090.   am.AddItem line3, "exitSongInfo"
  2091.   am.AddItem line4, "exitSongInfo"
  2092.  
  2093.   If (Not ArtistOneLine) Then         'Artist multiple lines
  2094.     am.AddItem line5, "exitSongInfo"
  2095.   Else                     'Artist single line
  2096.     Line6 = line5
  2097.   End If
  2098.   am.AddItem line6, "exitSongInfo"
  2099.   am.AddItem line7, "exitSongInfo"
  2100.   am.NextState=2
  2101.   am.Update
  2102. End Sub
  2103.  
  2104. Sub exitSongInfo()
  2105.   enterPlayList
  2106. End Sub
  2107.  
  2108.  
  2109.  
  2110. '------------------------------------ Seek --------------------------------------------
  2111.  
  2112. Public Showbar, NeededBars
  2113. Public RemSteps            'remaining steps to be shown at the last bar
  2114.  
  2115. Sub enterSeek()
  2116.   Dim p, steps, secPos
  2117.   deleteTimers
  2118.   'fma.AddTimer 1000, "seekUpdate"
  2119.  
  2120.   setGotoMethod("enterSeek")
  2121.   CurrentItem = "seek"
  2122.  
  2123.   SavePlayListPos = WinampCtrl.GetPlayListPosition
  2124.  
  2125.   WinampCtrl.SongPosParseTime = FALSE
  2126.   WinampCtrl.SetLengthParseTime = FALSE
  2127.  
  2128.   steps = WinampCtrl.GetSongLength\10            'total steps needed for the song
  2129.   RemSteps = steps mod 6                'steps needed in the last bar
  2130.   NeededBars = (steps\6) + 1
  2131.  
  2132.  
  2133.   secPos = (WinampCtrl.GetSongPosition\10000)        '10sec units
  2134.   Showbar = (secPos\6) + 1                'Set current bar to be shown
  2135.  
  2136.   p = secPos mod 6                    'Set step for seekSlide
  2137.  
  2138.   WinampCtrl.SetLengthParseTime = TRUE
  2139.  
  2140.   seekSlide(p)
  2141. End Sub
  2142.  
  2143. Sub deleteTimers
  2144.   fma.DeleteTimer("seekUpdate")
  2145.   fma.DeleteTimer("playlistUpdate")
  2146.   fma.DeleteTimer("songInfoUpdate")
  2147.   fma.DeleteTimer("winampUpdate")
  2148.   fma.DeleteTimer("mediaPlayerUpdate")
  2149.   fma.DeleteTimer("mp9seekUpdate")
  2150. End Sub
  2151.  
  2152. Sub seekSlide(i)
  2153.   Dim title
  2154.  
  2155.   WinampCtrl.SongPosParseTime = TRUE
  2156.   title = "(" & WinampCtrl.GetSongPosition & ")  " & WinampCtrl.GetSongLength
  2157.  
  2158.   If(Showbar = NeededBars) Then                'last bar shown steps
  2159.     am.DlgPercent title, "seekEvent", RemSteps, i
  2160.   Else
  2161.     am.DlgPercent title, "seekEvent", 6, i
  2162.   End If
  2163. End Sub
  2164.  
  2165. Sub seekUpdate
  2166.   WinampCtrl.SongPosParseTime = FALSE
  2167.   seekSlide((WinampCtrl.GetSongPosition\10000) mod 6)
  2168. End Sub
  2169.  
  2170. Sub seekEvent(value, final)
  2171.   Dim JumpTo, ShowLastBar
  2172.  
  2173.   If (final = 1) Then
  2174.     If (CurrentItem = "menu") Then
  2175.       winamp
  2176.     Else
  2177.       enterPlayList
  2178.     End If
  2179.   ElseIf(SavePlayListPos <> WinampCtrl.GetPlayListPosition) Then    'a new song is played
  2180.     enterSeek
  2181.   Else
  2182.     ShowLastBar = (Showbar = NeededBars)
  2183.     If (ShowLastBar) Then                                                        'last bar shown
  2184.       JumpTo = (((Showbar-1)*600) + (value*RemSteps) )*100
  2185.     Else
  2186.       JumpTo = ((Showbar-1)*100 + value )*600
  2187.     End If
  2188.  
  2189.     If (WinampCtrl.JumpToTime(JumpTo) = 0) Then        '0 = succes, -1 = not playing, 1 = eof
  2190.       If (value = 100) Then                'end of bar
  2191.         If (Not ShowLastBar) Then            'not last bar
  2192.           Showbar = Showbar + 1
  2193.           seekSlide(0)
  2194.         Else                        'end of song is reached
  2195.           winamp                    'goto winamp menu
  2196.         End If
  2197.  
  2198.       ElseIf ((value = 0) and (Showbar <> 1)) Then    'begin of bar and not first bar
  2199.         Showbar = Showbar - 1
  2200.         seekSlide(6)
  2201.       ElseIf (ShowLastBar) Then                'middle
  2202.           seekSlide(Round((value*RemSteps)/100))
  2203.       Else
  2204.           seekSlide(Round((value*6)/100))
  2205.       End If
  2206.     Else                        'not playing || eof
  2207.       WinampCtrl.Play
  2208.     End If
  2209.   End If
  2210. End Sub
  2211.  
  2212.  
  2213. '------------------ winamp volume control -----------------
  2214.  
  2215. Sub winampSlideVol()                    'Winamp volume slider
  2216.   CurrentItem = "volumeslide"
  2217.   am.DlgPercent "Winamp volume", "winampVolEvent", 10, WinampVol/25.5
  2218. End Sub
  2219.  
  2220. Sub winampVolEvent(value,final)
  2221.   WinampVol = value*2.55
  2222.   WinampCtrl.SetVolume = WinampVol
  2223.   If (final = 1) Then gotoMethod
  2224. End Sub
  2225.  
  2226.  
  2227. '----------------- winamp volume control ------------------
  2228.  
  2229. '----------------------------- shuffle & repeat & menu options ------------------------
  2230.  
  2231. Sub enterWinampOptions()
  2232.   am.Clear
  2233.   winampOptions
  2234. End Sub
  2235.  
  2236. Sub winampOptions()
  2237.   CurrentItem = "options"
  2238.   am.ClearMenu
  2239.   am.Title = "Winamp options"
  2240.  
  2241.   am.AddItem checkBox(WinampCtrl.shuffle) & "Shuffle", "enterShuffleToggle"
  2242.   am.AddItem checkBox(WinampCtrl.repeat) & "Repeat", "enterRepeatToggle"
  2243.   am.AddItem center("Reload playlist",""), "reloadPlayList"
  2244.  
  2245.   am.Back = "Winamp"
  2246.   am.NextState=2
  2247.   am.Update
  2248. End Sub
  2249.  
  2250. Sub enterShuffleToggle()
  2251.   WinampCtrl.Shuffle = Not WinampCtrl.Shuffle
  2252.   winampOptions
  2253. End Sub
  2254.  
  2255. Sub enterRepeatToggle()
  2256.   WinampCtrl.Repeat = Not WinampCtrl.Repeat
  2257.   winampOptions
  2258. End Sub
  2259.  
  2260. '----------------- end options ---------------------------
  2261.  
  2262. '---------------------------- Winamp Search -----------------------------------
  2263.  
  2264. Public SearchType
  2265.  
  2266. Sub winampSearch()
  2267.   setGotoMethod("winampSearch")
  2268.   CurrentItem = "winampSearch"
  2269.   deleteTimers
  2270.  
  2271.   am.Clear
  2272.   am.Title = "Winamp search"
  2273.  
  2274.   am.AddItem "Search artist", "searchArtist"
  2275.   am.AddItem "Search songtitle", "searchSong"
  2276.   am.AddItem "Show all artists", "enterAllArtists"
  2277.  
  2278.   am.Back = "enterWinamp"
  2279.   am.NextState=2
  2280.   am.Update
  2281. End Sub
  2282.  
  2283. Sub searchArtist
  2284.   SearchType = "artist"
  2285.   CurrentItem = "searchInput"
  2286.   am.DlgInputStr "Search artist", "Keyword:", 15, "", "searching"
  2287. End Sub
  2288.  
  2289. Sub searchSong
  2290.   SearchType = "title"
  2291.   CurrentItem = "searchInput"
  2292.   am.DlgInputStr "Search title", "Keyword:", 15, "", "searching"
  2293. End Sub
  2294.  
  2295. Sub simpleSearch
  2296.   SearchType = "simple"
  2297.   setGotoMethod("simpleSearch")
  2298.   CurrentItem = "simpleSearch"
  2299.   am.DlgInputStr "Search title", "Keyword:", 15, "", "searching"
  2300. End Sub
  2301.  
  2302. Sub searching(s)
  2303.   If (Trim(s) = "") Then
  2304.     If (SearchType = "simple") Then
  2305.       playlistOptions
  2306.     Else
  2307.       winampSearch
  2308.     End If
  2309.   Else
  2310.     am.DlgFeedback "Searching...", "winampSearch"
  2311.     am.update
  2312.     search s
  2313.   End If
  2314. End Sub
  2315.  
  2316. Public searchP
  2317.  
  2318. Sub playlistOptions
  2319.   setGotoMethod("playlistOptions")
  2320.   CurrentItem = "playlistOptions"
  2321.   am.Clear
  2322.   am.Title = "Playlist search"
  2323.   am.AddItem "Simple search", "simpleSearch"
  2324.   am.AddItem "Goto song#", "enterGotoSong"
  2325.   am.AddItem "Seek current song", "enterSeek"
  2326.   am.AddItem center("Reload playlist",""), "reloadPlayList"
  2327.  
  2328.   am.back = "enterPlayList"
  2329.   am.NextState=2
  2330.   am.Update
  2331. End Sub
  2332.  
  2333. Sub reloadPlayList
  2334.   SimpleSearchOn = FALSE
  2335.   UseSearchPlayList = FALSE
  2336.   GetPlayListBool  = TRUE
  2337.   getPlayList
  2338.  
  2339.   enterWinamp
  2340. End Sub
  2341.  
  2342. Sub enterGotoSong
  2343.   Dim title
  2344.   CurrentItem = "gotoSong"
  2345.   title = "[ 1 - " & CStr(getTotalSongs) & " ]"
  2346.   am.DlgInputInt title, "Goto song#:", 1, getTotalSongs, 1, "gotoSongEvent"
  2347. End Sub
  2348.  
  2349. Sub gotoSongEvent(i)
  2350.   PlayList(i-1)
  2351. End Sub
  2352.  
  2353. Public SimpleSearchOn
  2354. Public SearchResult
  2355.  
  2356. Sub simpleResults
  2357.   am.Clear
  2358.   am.Title = "Search results"
  2359.  
  2360.   If (SearchResult > 0) Then
  2361.     UseSearchPlayList = FALSE
  2362.     SimpleSearchOn = TRUE
  2363.     SearchP = 0
  2364.  
  2365.     If (SearchResult = 1) Then
  2366.       am.AddItem "1 result", "gotoSimpleSearchPlayList"
  2367.     Else
  2368.       am.AddItem SearchResult & " results", "gotoSimpleSearchPlayList"
  2369.     End If
  2370.  
  2371.     am.AddItem "New search", "simpleSearch"
  2372.   Else
  2373.     am.AddItem "No results", "enterPlaylist"
  2374.     am.AddItem "Search again", "simpleSearch"
  2375.   End If
  2376.  
  2377.   am.back = "playlistOptions"
  2378.   am.NextState=2
  2379.   am.Update
  2380. End Sub
  2381.  
  2382.  
  2383. Sub nextSearch
  2384.   If (SearchP<SearchResult-1) Then
  2385.     SearchP = SearchP+1
  2386.   Else
  2387.     SearchP = 0
  2388.   End If
  2389.   WinampCtrl.PlaySongByPosition(WinampCtrl.GetSearchSong(SearchP))
  2390.   playlist(WinampCtrl.GetSearchSong(SearchP))
  2391. End Sub
  2392.  
  2393. Sub prevSearch
  2394.   If (SearchP=0) Then
  2395.     SearchP = SearchResult-1
  2396.   Else
  2397.     SearchP = SearchP-1
  2398.   End If
  2399.   WinampCtrl.PlaySongByPosition(WinampCtrl.GetSearchSong(SearchP))
  2400.   playlist(WinampCtrl.GetSearchSong(SearchP))
  2401. End Sub
  2402.  
  2403. Sub gotoSimpleSearchPlayList
  2404.   playlist(WinampCtrl.GetSearchSong(0))
  2405. End Sub
  2406.  
  2407. Public PagePos
  2408.  
  2409. Sub search(s)    's always a nonempty string
  2410.  
  2411.   Select Case SearchType
  2412.     Case "artist"  SearchResult = WinampCtrl.SearchArtist(s)
  2413.     Case "title"   SearchResult = WinampCtrl.SearchSong(s)
  2414.     Case "simple"  SearchResult = WinampCtrl.SearchSong(s)
  2415.   End Select
  2416.  
  2417.   If (SearchResult > 0) Then
  2418.     UseSearchPlayList = TRUE
  2419.     Pos=0
  2420.   End If
  2421.  
  2422.   Select Case SearchType
  2423.     Case "artist"  enterArtistResults
  2424.     Case "title"   titleResults
  2425.     Case "simple"  simpleResults
  2426.   End Select
  2427. End Sub
  2428.  
  2429. Sub titleResults()
  2430.   am.Clear
  2431.   am.title = "Title results"
  2432.  
  2433.   If (SearchResult > 0) Then
  2434.     If (SearchResult = 1) Then
  2435.       am.AddItem SearchResult & " result" , "enterSearchPlayList"
  2436.     Else
  2437.       am.AddItem SearchResult & " results" , "enterSearchPlayList"
  2438.     End If
  2439.     am.AddItem "New search","searchSong"
  2440.   Else
  2441.     am.AddItem "No results", "enterPlaylist"
  2442.     am.AddItem "Search again", "searchSong"
  2443.   End If
  2444.  
  2445.   am.back = "winampSearch"
  2446.   am.NextState = 2
  2447.   am.Update
  2448. End Sub
  2449.  
  2450. Public SimpleSearchOnBackup
  2451.  
  2452. Sub enterSearchPlayList
  2453.   Dim i
  2454.   ReDim PlayListArray(SearchResult-1)        'resize array
  2455.  
  2456.   SimpleSearchOnBackup = SimpleSearchOn
  2457.   SimpleSearchOn = FALSE
  2458.  
  2459.   For i=0 To SearchResult-1
  2460.     PlayListArray(i) = WinampCtrl.GetSearchSong(i)
  2461.   Next
  2462.     PlayList(0)
  2463. End Sub
  2464.  
  2465. Sub enterArtistResults
  2466.   PagePos = 0
  2467.   artistResults
  2468. End Sub
  2469.  
  2470. Sub enterAllArtists   'show all artists
  2471.   SearchType = ""
  2472.   PagePos = 0
  2473.   allArtists
  2474. End Sub
  2475.  
  2476. Sub artistResults     'show results of artist search
  2477.   Dim i, i2
  2478.  
  2479.   setGotoMethod("artistResults")
  2480.   CurrentItem = "artistResults"
  2481.   am.Clear
  2482.  
  2483.   If(SearchResult > 0) Then        'results
  2484.     If (SearchResult = 1) Then
  2485.       am.Title = "[1/1]"
  2486.     Else
  2487.       am.Title = Left("[" & CStr(PagePos+1) & "/" & CStr((SearchResult \ NrResults)+1) & "]",15)
  2488.     End If
  2489.  
  2490.     i2 = PagePos*NrResults
  2491.     setItemPress("songsByArtist")
  2492.     For i=0 To NrResults-1
  2493.       If ((i2+i)<SearchResult) Then
  2494.         am.AddItem filter(WinampCtrl.GetSearchArtistString(i2+i)),"itemPress" & i
  2495.       Else
  2496.         Exit For
  2497.       End If
  2498.     Next
  2499.   Else                    'no results
  2500.     am.Title = "No results"
  2501.     am.AddItem "New search","winampSearch"
  2502.   End If
  2503.  
  2504.   am.back = "winampSearch"
  2505.   am.NextState = 2
  2506.   am.update
  2507. End Sub
  2508.  
  2509. Sub allArtists   'show list of all artists
  2510.   setGotoMethod("allArtists")
  2511.   CurrentItem = "allArtists"
  2512.   am.Clear
  2513.  
  2514.   SearchResult = WinampCtrl.GetTotalUniqueArtist
  2515.   am.Title = Left("[" & CStr(PagePos+1) & "/" & CStr((SearchResult \ NrResults)+1) & "]",15)
  2516.  
  2517.   Dim i, i2
  2518.   i2 = PagePos*NrResults
  2519.  
  2520.   setItemPress("songsByArtist")
  2521.   For i=0 To NrResults-1
  2522.     If ((i2+i)<WinampCtrl.GetTotalUniqueArtist) Then
  2523.      am.AddItem filter(WinampCtrl.GetUniqueArtist(i2+i)),"itemPress" & i
  2524.     Else
  2525.       Exit For
  2526.     End If
  2527.   Next
  2528.  
  2529.   am.back = "winampSearch"
  2530.   am.NextState = 2
  2531.   am.update
  2532. End Sub
  2533.  
  2534. Public NrResults 'nr search results on a page
  2535. NrResults = 6
  2536.  
  2537. Sub nextArtists  'next page of artists
  2538.   If (PagePos = (SearchResult\NrResults)) Then
  2539.     PagePos = 0
  2540.   Else
  2541.     PagePos = PagePos+1
  2542.   End If
  2543.  
  2544.   If (CurrentItem = "allArtists") Then
  2545.     allArtists
  2546.   Else
  2547.     artistResults
  2548.   End If
  2549. End Sub
  2550.  
  2551.  
  2552. Sub prevArtists  'prev page of artists
  2553.   If (PagePos = 0) Then
  2554.     PagePos = (SearchResult\NrResults)
  2555.   Else
  2556.     PagePos = PagePos - 1
  2557.   End If
  2558.  
  2559.   If (CurrentItem = "allArtists") Then
  2560.     allArtists
  2561.   Else
  2562.     artistResults
  2563.   End If
  2564. End Sub
  2565.  
  2566.  
  2567. Sub songsByArtist(index)          'show songs of artits with index
  2568.   Dim i,i2, j
  2569.   i2 = PagePos*NrResults
  2570.   If (CurrentItem = "allArtists") Then
  2571.     i = WinampCtrl.SearchSongsFromArtist(i2+index)        'if all artist are shown first artist = 0
  2572.   Else
  2573.     i = WinampCtrl.SearchSongsFromArtist(WinampCtrl.GetSearchArtist(i2+index))    'if search on artist
  2574.   End If
  2575.  
  2576.   If (i>0) Then        'if there are results then copy to winamparray
  2577.     UseSearchPlayList = TRUE
  2578.     ReDim PlayListArray(i-1)        'resize array
  2579.  
  2580.     For j=0 To i-1
  2581.       PlayListArray(j) = WinampCtrl.GetSearchSongsFromArtist(j)
  2582.     Next
  2583.     PlayList(0)
  2584.   End If
  2585. End Sub
  2586. '---------------------------- Winamp Search -----------------------------------
  2587.  
  2588.  
  2589.  
  2590. '---------------------------- Main Volume Control -----------------------------
  2591.  
  2592.  
  2593. Sub enterVolumeControl()
  2594.   am.Clear
  2595.   volumeControl
  2596. End Sub
  2597.  
  2598. Sub volumeControl()
  2599.   enterAppMenu(6)
  2600.  
  2601.   Dim VolStat
  2602.   VolStat = getVolumeStat
  2603.  
  2604.   am.Title = Left(VolStat,15)
  2605.  
  2606.   If VolStat = "Muted" Then
  2607.     am.AddItem "UnMute", "volMute"
  2608.   Else
  2609.     am.AddItem "Mute", "volMute"
  2610.     am.AddItem "Master volume", "masterVol"
  2611.   End If
  2612.  
  2613.   am.Back = "onAMRoot"
  2614.   am.NextState=2
  2615.   am.Update
  2616. End Sub
  2617.  
  2618. Sub masterVol()
  2619.   CurrentItem = "volumeslide"
  2620.  
  2621.   If (VolumeCtrl.Mute = 0) Then                            'not muted
  2622.     am.DlgPercent "Master volume", "masterVolEvent", 10 , VolumeCtrl.Volume/10
  2623.   Else                                        'muted
  2624.     volumeControl
  2625.   End If
  2626. End Sub
  2627.  
  2628.  
  2629. Sub masterVolEvent(value, final)
  2630.   VolumeCtrl.Volume = value
  2631.   If final = 1 Then GotoMethod
  2632. End Sub
  2633.  
  2634. Sub volMute()
  2635.   If VolumeCtrl.Mute = 1 Then
  2636.     VolumeCtrl.Mute = 0
  2637.   Else
  2638.     VolumeCtrl.Mute = 1
  2639.   End If
  2640.  
  2641.   volumeControl
  2642. End Sub
  2643.  
  2644.  
  2645. Function getVolumeStat()
  2646.   If VolumeCtrl.Mute = 1 Then
  2647.     getVolumeStat = "Muted"
  2648.   Else
  2649.     getVolumeStat = "Vol: " & VolumeCtrl.Volume & "%"
  2650.   End If
  2651. End Function
  2652.  
  2653.  
  2654. '--------------------- app functions -------------
  2655.  
  2656. Sub setAppName(s)
  2657.   AppName = s
  2658. End Sub
  2659.  
  2660. Sub enterAppMenu(id)            'called in appsubs to set proper id and title
  2661.   CurrentID = RootID(id,0)
  2662.   CurrentItem = "menu"
  2663.  
  2664.   am.ClearMenu
  2665.   am.Title = Left(RootID(id,1),15)
  2666. End Sub
  2667.  
  2668.  
  2669. '----------------------------------------------------------------------------------
  2670.  
  2671. Sub channelList()
  2672.   setGotoMethod("channelList")
  2673.   CurrentItem = "channelList"
  2674.   am.Clear
  2675.   am.Title = "Remote mode"
  2676.   setItemPress("sendKey")
  2677.   am.AddItem center("Press (0-9)",""), "channelList"
  2678.  
  2679.   am.Back = RootID(CurrentID,2)
  2680.   am.NextState=2
  2681.   am.Update
  2682. End Sub
  2683.  
  2684. Public AppName
  2685.  
  2686. Sub sendKey(i)
  2687.   If shell.AppActivate(AppName) Then shell.SendKeys(i)
  2688.   channelList
  2689. End Sub
  2690.  
  2691. Sub channel0
  2692.   If shell.AppActivate(AppName) Then shell.SendKeys(0)
  2693.   channelList
  2694. End Sub
  2695. Sub channel1
  2696.   If shell.AppActivate(AppName) Then shell.SendKeys(1)
  2697.   channelList
  2698. End Sub
  2699. Sub channel2
  2700.   If shell.AppActivate(AppName) Then shell.SendKeys(2)
  2701.   channelList
  2702. End Sub
  2703. Sub channel3
  2704.   If shell.AppActivate(AppName) Then shell.SendKeys(3)
  2705.   channelList
  2706. End Sub
  2707. Sub channel4
  2708.   If shell.AppActivate(AppName) Then shell.SendKeys(4)
  2709.   channelList
  2710. End Sub
  2711. Sub channel5
  2712.   If shell.AppActivate(AppName) Then shell.SendKeys(5)
  2713.   channelList
  2714. End Sub
  2715. Sub channel6
  2716.   If shell.AppActivate(AppName) Then shell.SendKeys(6)
  2717.   channelList
  2718. End Sub
  2719. Sub channel7
  2720.   If shell.AppActivate(AppName) Then shell.SendKeys(7)
  2721.   channelList
  2722. End Sub
  2723. Sub channel8
  2724.   If shell.AppActivate(AppName) Then shell.SendKeys(8)
  2725.   channelList
  2726. End Sub
  2727. Sub channel9
  2728.   If shell.AppActivate(AppName) Then shell.SendKeys(9)
  2729.   channelList
  2730. End Sub
  2731.  
  2732.  
  2733. '---------------------------- Hauppauge WinTV ---------------------------------
  2734.  
  2735. 'id=0
  2736. Sub enterWinTV()
  2737.   setAppName("WinTV32")
  2738.   AppOpen = shell.AppActivate("WinTV32")
  2739.  
  2740.   am.Clear
  2741.   winTV
  2742. End Sub
  2743.  
  2744. Sub winTV()
  2745.   enterAppMenu(0)
  2746.  
  2747.   If (AppOpen) Then
  2748.     am.AddItem "Remote mode", "channelList"
  2749.     am.AddItem "Mute", "winTVMute"
  2750.     am.AddItem "Fullscreen", "winTVFullscreen"
  2751.     am.AddItem "Freeze", "winTVFreeze"
  2752.     If (MyPhoneType(1)=3) Then
  2753.       am.AddItem "Snapshot", "winTVSnapshot"
  2754.     End If
  2755.     am.AddItem "Source", "winTVSource"
  2756.     am.AddItem "Close WinTV", "winTVClose"
  2757.   Else
  2758.     am.AddItem "Launch WinTV", "winTVLaunch"
  2759.   End If
  2760.  
  2761.   am.Back = "onAMRoot"
  2762.   am.NextState=2
  2763.   am.Update
  2764. End Sub
  2765.  
  2766. Sub winTVLaunch()
  2767.   LaunchAppDlg
  2768.   shell.Exec RootEXE(0)
  2769.   AppOpen = TRUE
  2770.   winTV
  2771. End Sub
  2772. Sub winTVClose()
  2773.   CloseAppDlg
  2774.   If shell.AppActivate("WinTV32") Then shell.SendKeys("%{F4}")
  2775.   AppOpen = FALSE
  2776.   winTV
  2777. End Sub
  2778.  
  2779. Sub winTVSnapshot()
  2780.   If shell.AppActivate("WinTV32") Then shell.SendKeys("{ }")
  2781.   am.Update
  2782. End Sub
  2783. Sub winTVSource()
  2784.   If shell.AppActivate("WinTV32") Then shell.SendKeys("^s")
  2785.   am.update
  2786. End Sub
  2787. Sub winTVFreeze()
  2788.   If shell.AppActivate("WinTV32") Then shell.SendKeys("^f")
  2789.   am.Update
  2790. End Sub
  2791. Sub winTVChannelDown()
  2792.   If shell.AppActivate("WinTV32") Then shell.SendKeys("{-}")
  2793.   am.Update
  2794. End Sub
  2795. Sub winTVChannelUp()
  2796.   If shell.AppActivate("WinTV32") Then shell.SendKeys("{+}")
  2797.   am.Update
  2798. End Sub
  2799.  
  2800. Sub winTVFullscreen()
  2801.   If shell.AppActivate("WinTV32") Then shell.SendKeys("^t")
  2802.   am.update
  2803. End Sub
  2804. Sub winTVMute()
  2805.   If shell.AppActivate("WinTV32") Then shell.SendKeys("^m")
  2806.   am.update
  2807. End Sub
  2808.  
  2809. '--------------------------- MoreTV -----------------------------------------
  2810. 'id=1
  2811.  
  2812. Sub enterMoreTV()
  2813.   setAppName("MoreTV")
  2814.   AppOpen = shell.AppActivate("MoreTV")
  2815.  
  2816.   am.Clear
  2817.   moreTV
  2818. End Sub
  2819.  
  2820. Sub moreTV()
  2821.   enterAppMenu(1)
  2822.  
  2823.   If (AppOpen) Then
  2824.     am.AddItem "Remote Mode", "channelList"
  2825.     am.AddItem "Mute", "moreTVMute"
  2826.     am.AddItem "Fullscreen", "moreTVFullscreen"
  2827.     am.AddItem "Videotext", "moreTVVideotext"
  2828.     am.AddItem "Close MoreTV", "moreTVClose"
  2829.   Else
  2830.     am.AddItem "Launch MoreTV", "moreTVLaunch"
  2831.   End If
  2832.  
  2833.   am.Back = "onAMRoot"
  2834.   am.NextState=2
  2835.   am.Update
  2836. End Sub
  2837.  
  2838. Sub moreTVLaunch()
  2839.   LaunchAppDlg
  2840.   shell.Exec RootEXE(1)
  2841.   AppOpen = TRUE
  2842.   moreTV
  2843. End Sub
  2844. Sub moreTVClose()
  2845.   CloseAppDlg
  2846.   If shell.AppActivate("MoreTV") Then shell.SendKeys("{F10}")
  2847.   AppOpen = FALSE
  2848.   moreTV
  2849. End Sub
  2850.  
  2851. Sub moreTVChannelUp()
  2852.   If shell.AppActivate("MoreTV") Then shell.SendKeys("{UP}")
  2853.   am.Update
  2854. End Sub
  2855. Sub moreTVChannelDown()
  2856.   If shell.AppActivate("MoreTV") Then shell.SendKeys("{DOWN}")
  2857.   am.Update
  2858. End Sub
  2859. Sub moreTVMute()
  2860.   If shell.AppActivate("MoreTV") Then shell.SendKeys("m")
  2861.   am.Update
  2862. End Sub
  2863. Sub moreTVVideotext()
  2864.   If shell.AppActivate("MoreTV") Then shell.SendKeys("v")
  2865.   am.Update
  2866. End Sub
  2867. Sub moreTVFullscreen()
  2868.   If shell.AppActivate("MoreTV") Then shell.SendKeys("{F9}")
  2869.   am.Update
  2870. End Sub
  2871.  
  2872. '--------------------------- DScaler -----------------------------------------
  2873. 'id=12
  2874. Sub enterDScaler()
  2875.   setAppName("DScaler")
  2876.   AppOpen = shell.AppActivate("DScaler")
  2877.  
  2878.   am.Clear
  2879.   dScaler
  2880. End Sub
  2881.  
  2882. Sub dScaler()
  2883.   enterAppMenu(12)
  2884.  
  2885.   If (AppOpen) Then
  2886.     am.AddItem "Remote mode", "channelList"
  2887.     am.AddItem "Mute", "dScalerMute"
  2888.     am.AddItem "Fullscreen", "dScalerFullscreen"
  2889.     am.AddItem "Last channel", "dScalerLastChannel"
  2890.     am.AddItem "Freeze", "dScalerFreeze"
  2891.     If (MyPhoneType(1)=3) Then
  2892.       am.AddItem "Snapshot", "dScalerSnapshot"
  2893.     End If
  2894.     am.AddItem "Start recording", "dScalerStartRecord"
  2895.     am.AddItem "Stop recording", "dScalerStopRecord"
  2896.     am.AddItem "Preview", "dScalerPreview"
  2897.     am.AddItem "Teletext", "dScalerTeletext"
  2898.     am.AddItem "Zoom +", "dScalerZoomIn"
  2899.     am.AddItem "Zoom -", "dScalerZoomOut"
  2900.     am.AddItem "Info", "dScalerInfo"
  2901.     am.AddItem "Close DScaler", "dScalerClose"
  2902.   Else
  2903.     am.AddItem "Launch DScaler", "dScalerLaunch"
  2904.   End If
  2905.  
  2906.   am.Back = "onAMRoot"
  2907.   am.NextState=2
  2908.   am.Update
  2909. End Sub
  2910.  
  2911. Sub dScalerLaunch()
  2912.   LaunchAppDlg
  2913.   shell.Exec RootEXE(12)
  2914.   AppOpen = TRUE
  2915.   dScaler
  2916. End Sub
  2917. Sub dScalerClose()
  2918.   CloseAppDlg
  2919.   If shell.AppActivate("DScaler") Then shell.SendKeys("%{F4}")
  2920.   AppOpen = FALSE
  2921.   dScaler
  2922. End Sub
  2923.  
  2924. Sub dScalerSnapshot()
  2925.   If shell.AppActivate("DScaler") Then shell.SendKeys("l")
  2926.   am.Update
  2927. End Sub
  2928. Sub dScalerFreeze()
  2929.   If shell.AppActivate("DScaler") Then shell.SendKeys("p")
  2930.   am.Update
  2931. End Sub
  2932. Sub dScalerChannelDown()
  2933.   If shell.AppActivate("DScaler") Then shell.SendKeys("{PGDN}")
  2934.   am.Update
  2935. End Sub
  2936. Sub dScalerChannelUp()
  2937.   If shell.AppActivate("DScaler") Then shell.SendKeys("{PGUP}")
  2938.   am.Update
  2939. End Sub
  2940.  
  2941. Sub dScalerStartRecord()
  2942.   If shell.AppActivate("DScaler") Then shell.SendKeys("+{R}")
  2943.   am.Update
  2944. End Sub
  2945. Sub dScalerStopRecord()
  2946.   If shell.AppActivate("DScaler") Then shell.SendKeys("+{S}")
  2947.   am.Update
  2948. End Sub
  2949. Sub dScalerPreview()
  2950.   If shell.AppActivate("DScaler") Then shell.SendKeys("{INSERT}")
  2951.   am.Update
  2952. End Sub
  2953. Sub dScalerLastChannel()
  2954.   If shell.AppActivate("DScaler") Then shell.SendKeys("^{BKSP}")
  2955.   am.Update
  2956. End Sub
  2957. Sub dScalerZoomIn()
  2958.   If shell.AppActivate("DScaler") Then shell.SendKeys("+{Z}")
  2959.   am.update
  2960. End Sub
  2961. Sub dScalerZoomOut()
  2962.   If shell.AppActivate("DScaler") Then shell.SendKeys("z")
  2963.   am.update
  2964. End Sub
  2965. Sub dScalerFullscreen()
  2966.   If shell.AppActivate("DScaler") Then shell.SendKeys("%{ENTER}")
  2967.   am.update
  2968. End Sub
  2969. Sub dScalerTeletext()
  2970.   If shell.AppActivate("DScaler") Then shell.SendKeys("t")
  2971.   am.update
  2972. End Sub
  2973. Sub dScalerMute()
  2974.   If shell.AppActivate("DScaler") Then shell.SendKeys("m")
  2975.   am.update
  2976. End Sub
  2977. Sub dScalerInfo()
  2978.   If shell.AppActivate("DScaler") Then shell.SendKeys("{ENTER}")
  2979.   am.update
  2980. End Sub
  2981.  
  2982.  
  2983.  
  2984. '--------------------------- BSPlayer -----------------------------------------
  2985. 'id=4
  2986.  
  2987. Sub enterBSPlayer()
  2988.   AppOpen = shell.AppActivate("BSPlayer")
  2989.   am.Clear
  2990.   bsPlayer
  2991. End Sub
  2992.  
  2993. Sub bsPlayer()
  2994.   enterAppMenu(4)
  2995.  
  2996.   If (AppOpen) Then
  2997.     am.AddItem "Play", "bsPlayerPlay"
  2998.     am.AddItem "Pause", "bsPlayerPause"
  2999.     am.AddItem "Stop", "bsPlayerStop"
  3000.     am.AddItem "Fullscreen", "bsPlayerFullscreen"
  3001.     am.AddItem "Sub Toggle", "bsPlayerSub"
  3002.     am.AddItem "Zoom", "bsPlayerZoom"
  3003.     am.AddItem "Close BSPlayer", "bsPlayerClose"
  3004.   Else
  3005.     am.AddItem "Launch BSPlayer", "bsPlayerLaunch"
  3006.   End If
  3007.  
  3008.   am.Back = "onAMRoot"
  3009.   am.NextState=2
  3010.   am.Update
  3011. End Sub
  3012.  
  3013. Sub bsPlayerLaunch()
  3014.   LaunchAppDlg
  3015.   shell.Exec RootEXE(4)
  3016.   AppOpen = TRUE
  3017.   bsPlayer
  3018. End Sub
  3019. Sub bsPlayerClose()
  3020.   CloseAppDlg
  3021.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("%{F4}")
  3022.   AppOpen = FALSE
  3023.   bsPlayer
  3024. End Sub
  3025.  
  3026. Sub bsPlayerPlay()
  3027.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("x")
  3028.   am.Update
  3029. End Sub
  3030. Sub bsPlayerPause()
  3031.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("c")
  3032.   am.Update
  3033. End Sub
  3034. Sub bsPlayerStop()
  3035.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("v")
  3036.   am.Update
  3037. End Sub
  3038. Sub bsPlayerPrev()
  3039.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("y")
  3040.   am.Update
  3041. End Sub
  3042. Sub bsPlayerNext()
  3043.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("b")
  3044.   am.Update
  3045. End Sub
  3046. Sub bsPlayerFullscreen()
  3047.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("f")
  3048.   am.Update
  3049. End Sub
  3050. Sub bsPlayerSub()
  3051.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("s")
  3052.   am.Update
  3053. End Sub
  3054.  
  3055.  
  3056. '------------------ BSPlayer Zoom control -----------------
  3057.  
  3058. Sub bsPlayerZoom()
  3059.   CurrentItem = "zoom"
  3060.   am.DlgPercent "Zoom control", "bsPlayerZoomEvent", 2, BSPlayerZoomValue
  3061. End Sub
  3062.  
  3063. Sub bsPlayerZoomEvent(value,final)
  3064.   If (final = 1) Then
  3065.     bsPlayer
  3066.   ElseIf (value = 0) Then
  3067.     bsPlayerZoom1
  3068.   ElseIf (value = 100) Then
  3069.     bsPlayerZoom3
  3070.   Else
  3071.     bsPlayerZoom2
  3072.   End If
  3073. End Sub
  3074.  
  3075. Sub bsPlayerZoom1()
  3076.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("1")
  3077.   BSPlayerZoomValue = 0
  3078. End Sub
  3079. Sub bsPlayerZoom2()
  3080.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("2")
  3081.   BSPlayerZoomValue = 1
  3082. End Sub
  3083. Sub bsPlayerZoom3()
  3084.   If shell.AppActivate("BSPlayer") Then shell.SendKeys("3")
  3085.   BSPlayerZoomValue = 2
  3086. End Sub
  3087.  
  3088. '----------------- ZoomPlayer control ------------------
  3089. 'id=13
  3090.  
  3091. Sub enterZoomPlayer()
  3092.   AppOpen = shell.AppActivate("ZoomPlayer")
  3093.   am.Clear
  3094.   zoomPlayer
  3095. End Sub
  3096.  
  3097. Sub zoomPlayer()
  3098.   enterAppMenu(13)
  3099.  
  3100.   If (AppOpen) Then
  3101.     am.AddItem "Play/Pause", "zoomPlayerPlay"
  3102.     am.AddItem "Stop", "zoomPlayerStop"
  3103.     am.AddItem "Jump ahead", "zoomPlayerJumpAhead"
  3104.     am.AddItem "Jump back", "zoomPlayerJumpBack"
  3105.     am.AddItem "Mute", "zoomPlayerVolumeMute"
  3106.     am.AddItem "Fullscreen", "zoomPlayerFullscreen"
  3107.     am.AddItem "Fast Fwd", "zoomPlayerFastForward"
  3108.     am.AddItem "Rewind", "zoomPlayerRewind"
  3109.     am.AddItem "SubTitles", "zoomPlayerSubtitles"
  3110.     am.AddItem "Close ZoomPlayer", "zoomPlayerClose"
  3111.   Else
  3112.     am.AddItem "Launch ZoomPlayer", "zoomPlayerLaunch"
  3113.   End If
  3114.  
  3115.   am.Back = "onAMRoot"
  3116.   am.NextState=2
  3117.   am.Update
  3118. End Sub
  3119.  
  3120. Sub zoomPlayerLaunch()
  3121.   LaunchAppDlg
  3122.   shell.Exec RootEXE(13)
  3123.   AppOpen = TRUE
  3124.   zoomPlayer
  3125. End Sub
  3126. Sub zoomPlayerClose()
  3127.   CloseAppDlg
  3128.   If shell.AppActivate("ZoomPlayer") Then shell.SendKeys("%{x}")
  3129.   AppOpen = FALSE
  3130.   zoomPlayer
  3131. End Sub
  3132.  
  3133. Sub zoomPlayerPlay
  3134.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("p")
  3135.     am.Update
  3136. End Sub
  3137. Sub zoomPlayerStop
  3138.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("s")
  3139.     am.Update
  3140. End Sub
  3141. Sub zoomPlayerPrev
  3142.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("+[")
  3143.     am.Update
  3144. End Sub
  3145. Sub zoomPlayerNext
  3146.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("+]")
  3147.     am.Update
  3148. End Sub
  3149. Sub zoomPlayerJumpAhead
  3150.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("%.")
  3151.     am.Update
  3152. End Sub
  3153. Sub zoomPlayerJumpBack
  3154.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("%,")
  3155.     am.Update
  3156. End Sub
  3157. Sub zoomPlayerVolumeUp
  3158.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("+{UP}")
  3159.     am.Update
  3160. End Sub
  3161. Sub zoomPlayerVolumeDn
  3162.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("+{DOWN}")
  3163.     am.Update
  3164. End Sub
  3165. Sub zoomPlayerVolumeMute
  3166.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("^m")
  3167.     am.Update
  3168. End Sub
  3169. Sub zoomPlayerSubtitles
  3170.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("+;")
  3171.     am.Update
  3172. End Sub
  3173. Sub zoomPlayerFullscreen
  3174.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("%{ENTER}")
  3175.     am.Update
  3176. End Sub
  3177. Sub zoomPlayerFastForward
  3178.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("%{HOME}")
  3179.     am.Update
  3180. End Sub
  3181. Sub zoomPlayerRewind
  3182.     If shell.AppActivate("ZoomPlayer") Then Shell.SendKeys("%{END}")
  3183.     am.Update
  3184. End Sub
  3185.  
  3186. '----------------- RadLight control ------------------
  3187. 'id=16
  3188.  
  3189. Sub enterRadLight()
  3190.   AppOpen = shell.AppActivate("RadLight")
  3191.   am.Clear
  3192.   RadLight
  3193. End Sub
  3194.  
  3195. Sub RadLight()
  3196.   enterAppMenu(16)
  3197.  
  3198.   If (AppOpen) Then
  3199.     am.AddItem "Play", "RadLightPlay"
  3200.     am.AddItem "Stop", "RadLightStop"
  3201.     am.AddItem "Pause", "RadLightPause"
  3202.     am.AddItem "Mute", "RadLightVolumeMute"
  3203.     am.AddItem "Fullscreen", "RadLightFullscreen"
  3204.     am.AddItem "Fast Fwd", "RadLightFastForward"
  3205.     am.AddItem "Rewind", "RadLightRewind"
  3206.     am.AddItem "SubTitles", "RadLightSubtitles"
  3207.     am.AddItem "Close RadLight", "RadLightClose"
  3208.   Else
  3209.     am.AddItem "Launch RadLight", "RadLightLaunch"
  3210.   End If
  3211.  
  3212.   am.Back = "onAMRoot"
  3213.   am.NextState=2
  3214.   am.Update
  3215. End Sub
  3216.  
  3217. Sub RadLightLaunch()
  3218.   LaunchAppDlg
  3219.   shell.Exec RootEXE(16)
  3220.   AppOpen = TRUE
  3221.   RadLight
  3222. End Sub
  3223. Sub RadLightClose()
  3224.   CloseAppDlg
  3225.   If shell.AppActivate("RadLight") Then shell.SendKeys("^{x}")
  3226.   AppOpen = FALSE
  3227.   RadLight
  3228. End Sub
  3229.  
  3230. Sub RadLightPlay
  3231.     If shell.AppActivate("RadLight") Then Shell.SendKeys("x")
  3232.     am.Update
  3233. End Sub
  3234. Sub RadLightStop
  3235.     If shell.AppActivate("RadLight") Then Shell.SendKeys("c")
  3236.     am.Update
  3237. End Sub
  3238. Sub RadLightPause
  3239.     If shell.AppActivate("RadLight") Then Shell.SendKeys("{ }")
  3240.     am.Update
  3241. End Sub
  3242. Sub RadLightPrev
  3243.     If shell.AppActivate("RadLight") Then Shell.SendKeys("z")
  3244.     am.Update
  3245. End Sub
  3246. Sub RadLightNext
  3247.     If shell.AppActivate("RadLight") Then Shell.SendKeys("b")
  3248.     am.Update
  3249. End Sub
  3250.  
  3251. Sub RadLightVolumeUp
  3252.     If shell.AppActivate("RadLight") Then Shell.SendKeys("+{UP}")
  3253.     am.Update
  3254. End Sub
  3255. Sub RadLightVolumeDn
  3256.     If shell.AppActivate("RadLight") Then Shell.SendKeys("+{DOWN}")
  3257.     am.Update
  3258. End Sub
  3259. Sub RadLightVolumeMute
  3260.     If shell.AppActivate("RadLight") Then Shell.SendKeys("^m")
  3261.     am.Update
  3262. End Sub
  3263. Sub RadLightSubtitles
  3264.     If shell.AppActivate("RadLight") Then Shell.SendKeys("s")
  3265.     am.Update
  3266. End Sub
  3267. Sub RadLightFullscreen
  3268.     If shell.AppActivate("RadLight") Then Shell.SendKeys("f")
  3269.     am.Update
  3270. End Sub
  3271. Sub RadLightFastForward
  3272.     If shell.AppActivate("RadLight") Then Shell.SendKeys("+{RIGHT}")
  3273.     am.Update
  3274. End Sub
  3275. Sub RadLightRewind
  3276.     If shell.AppActivate("RadLight") Then Shell.SendKeys("%{LEFT}")
  3277.     am.Update
  3278. End Sub
  3279.  
  3280. '----------------------------- Windows Media Player Control -----------------------------
  3281. 'id=5
  3282.  
  3283. Sub enterMediaPlayer()
  3284. dim dwnld
  3285.   If (WMPplginI) Then
  3286.     AppOpen = WMPplugin.Running
  3287.     am.Clear
  3288.     mediaPlayer
  3289.   Else
  3290.     dwnld = MsgBox ("Warning!" & Chr(13) & "You don't have Windows Media Player control plugin installed, you can download it from http://www.mediatexx.com/download/wmpuice.zip, if you don't install it you won't be able to control WMP using your mobile phone." & Chr(13) & "Download it now?", 52, "floAt's Mobile Agent")
  3291.     If dwnld=6 Then
  3292.       Shell.Run "RunDLL32.EXE url.dll, FileProtocolHandler http://www.mediatexx.com/download/wmpuice.zip"
  3293.     End If
  3294.     am.Update
  3295.   End If
  3296. End Sub
  3297.  
  3298. Public WMPcurrentItemState
  3299.  
  3300. Sub mediaPlayerUpdate
  3301. dim WMPnewState, songName
  3302.  
  3303.   If (WMPplugin.Running) Then
  3304.     WMPnewState = WMPcurrentItemState
  3305.     If (WMPCtrl.currentPlaylist.count>0) Then
  3306.       songName = Filter(WMPCtrl.currentMedia.name)
  3307.       If (WMPCtrl.currentMedia.getItemInfo("Artist")<>"") Then
  3308.         songName = songName & " - " & Filter(WMPCtrl.currentMedia.getItemInfo("Artist"))
  3309.       End If
  3310.       If (WMPCtrl.playState=2) Then
  3311.         WMPcurrentItemState = "| | " & songName
  3312.       ElseIf (WMPCtrl.playState=3) Then
  3313.         WMPcurrentItemState = "> " & songName
  3314.       ElseIf (WMPCtrl.playState=9) Then
  3315.         WMPcurrentItemState = "[opening] " & songName
  3316.       Else
  3317.         WMPcurrentItemState = "[ ] " & songName
  3318.       End If
  3319.  
  3320.       If (WMPcurrentItemState <> WMPnewState)and(CurrentItem="menu")and(CurrentID = RootID(5,0)) Then
  3321.         enterMediaPlayer
  3322.       ElseIf (CurrentItem<>"menu")or(CurrentID<>RootID(5,0)) Then
  3323.         fma.DeleteTimer("mediaPlayerUpdate")
  3324.       End If
  3325.     Else
  3326.       WMPcurrentItemState = "(blank playlist)"
  3327.       If (WMPcurrentItemState <> WMPnewState)and(CurrentItem="menu")and(CurrentID = RootID(5,0)) Then
  3328.         enterMediaPlayer
  3329.       ElseIf (CurrentItem<>"menu")or(CurrentID<>RootID(5,0)) Then
  3330.         fma.DeleteTimer("mediaPlayerUpdate")
  3331.       End If
  3332.     End If
  3333.   Else
  3334.     deleteTimers
  3335.     If (CurrentID = RootID(5,0)) Then enterMediaPlayer
  3336.   End If
  3337. End Sub
  3338.  
  3339. Sub mediaPlayer()
  3340. dim songName
  3341.   am.ClearMenu
  3342.   enterAppMenu(5)
  3343.   deleteTimers
  3344.   If AppOpen Then
  3345.     Pos = 0
  3346.     Set WMPCtrl = WMPplugin.Core
  3347.     fma.AddTimer 4000, "mediaPlayerUpdate"
  3348.     If (WMPCtrl.currentPlaylist.count>0) Then
  3349.       songName = Filter(WMPCtrl.currentMedia.name)
  3350.       If (WMPCtrl.currentMedia.getItemInfo("Artist")<>"") Then
  3351.         songName = songName & " - " & Filter(WMPCtrl.currentMedia.getItemInfo("Artist"))
  3352.       End If
  3353.       If WMPCtrl.playState=2 Then
  3354.         WMPcurrentItemState = "| | " & songName
  3355.         am.AddItem WMPcurrentItemState, "mp9currPlaylist"
  3356.         am.AddItem "Resume", "mp9PlayPause"
  3357.         am.AddItem "Stop", "mp9Stop"
  3358.         am.AddItem "Seek", "mp9enterSeek"
  3359.       ElseIf (WMPCtrl.playState=3) Then
  3360.         WMPcurrentItemState = "> " & songName
  3361.         am.AddItem WMPcurrentItemState, "mp9currPlaylist"
  3362.         am.AddItem "Pause", "mp9PlayPause"
  3363.         am.AddItem "Stop", "mp9Stop"
  3364.         am.AddItem "Seek", "mp9enterSeek"
  3365.       ElseIf (WMPCtrl.playState=9) Then
  3366.         WMPcurrentItemState = "[opening] " & songName
  3367.         am.AddItem WMPcurrentItemState, "mp9currPlaylist"
  3368.         am.AddItem "Play", "mp9PlayPause"
  3369.         am.AddItem "Stop", "mp9Stop"
  3370.       Else
  3371.         WMPcurrentItemState = "[ ] " & songName
  3372.         am.AddItem WMPcurrentItemState, "mp9currPlaylist"
  3373.         am.AddItem "Play", "mp9PlayPause"
  3374.       End If
  3375.     Else
  3376.       WMPcurrentItemState = "(blank playlist)"
  3377.       am.AddItem WMPcurrentItemState, "mp9Playlists"
  3378.     End If
  3379.     am.AddItem "Playlist: " & Filter(WMPCtrl.currentPlaylist.name) &", items: "& WMPCtrl.currentPlaylist.count, "mp9Playlists"
  3380.     am.AddItem "Search in Media Library", "mp9LibrarySearch"
  3381.     am.AddItem checkBox(WMPCtrl.settings.getMode("shuffle")) & "Shuffle", "mp9Shuffle"
  3382.     am.AddItem checkBox(WMPCtrl.settings.getMode("loop")) & "Repeat", "mp9Repeat"
  3383. '    If (WMPCtrl.fullScreen) Then                            'couldn't get it to work
  3384. '      am.AddItem "Exit Fullscreen", "mp9Fullscreen"
  3385. '    Else
  3386.     am.AddItem "Fullscreen", "mp9Fullscreen"
  3387. '    End If
  3388.     am.AddItem "Change speed", "mp9speed"
  3389.     am.AddItem "Close WMP", "mp9Close"
  3390.   Else
  3391.     am.AddItem "Launch WMP", "mp9Launch"
  3392.   End If
  3393.     am.Back = "onAMRoot"
  3394.     am.NextState=2
  3395.     am.Update
  3396. End Sub
  3397.  
  3398. '----------------------------------------------
  3399. Sub mp9PlayPause()
  3400.   If (WMPCtrl.playstate=3) Then
  3401.     WMPCtrl.controls.pause
  3402.   Else
  3403.     WMPCtrl.controls.play
  3404.   End If
  3405.   mediaPlayer
  3406. End Sub
  3407. Sub mp9Stop()
  3408.   WMPCtrl.controls.stop
  3409.   mediaPlayer
  3410. End Sub
  3411. Sub mp9NextItem()
  3412.   WMPCtrl.controls.next
  3413.   enterMediaPlayer
  3414. End Sub
  3415. Sub mp9PrevItem()
  3416.   WMPCtrl.controls.previous
  3417.   enterMediaPlayer
  3418. End Sub
  3419.  
  3420. Sub mp9speed()
  3421. dim currentPlayRate
  3422.   If (WMPCtrl.settings.rate>=1) Then
  3423.   currentPlayRate = WMPCtrl.settings.rate*5
  3424.   Else
  3425.   currentPlayRate = WMPCtrl.settings.rate*10-5
  3426.   End If
  3427.   CurrentItem = "mp9rate"
  3428.   am.DlgPercent "Speed", "mp9SpeedChange", 10 , currentPlayRate
  3429.   am.Back = "enterMediaPlayer"
  3430. End Sub
  3431.  
  3432. Sub mp9SpeedChange(value, final)
  3433.   If (value>40) Then
  3434.     WMPCtrl.settings.rate = value*0.02
  3435.   Else
  3436.     WMPCtrl.settings.rate = value*0.01+0.5
  3437.   End If
  3438.   If final = 1 Then GotoMethod
  3439. End Sub
  3440.  
  3441. Sub mp9Fullscreen
  3442.   WMPplugin.Fullscreen
  3443.   mediaPlayer
  3444. End Sub
  3445.  
  3446. ' let's use Showbar, NeededBars from winamp
  3447.  
  3448. Sub mp9enterSeek
  3449. dim curPos, h1,h2,m1,m2,s1,s2,title
  3450.   If (WMPplugin.Running) Then
  3451.     If (WMPCtrl.playState=2) or (WMPCtrl.playState=3) Then
  3452.       deleteTimers
  3453.       fma.AddTimer 1000, "mp9seekUpdate"
  3454.       CurrentItem = "mp9seek"
  3455.       NeededBars = (WMPCtrl.currentMedia.duration \ 60) + 1
  3456.       Showbar = (WMPCtrl.controls.currentPosition \ 60) + 1
  3457.       curPos = (WMPCtrl.controls.currentPosition - ((Showbar-1)*60))\10
  3458.       Pos = curPos
  3459.       If (curPos=0) and (Showbar>1) Then
  3460.         curPos = 6
  3461.         Showbar = Showbar-1
  3462.       End If
  3463.  
  3464.       h1 = WMPCtrl.controls.currentPosition \ 3600
  3465.       m1 = (WMPCtrl.controls.currentPosition-(3600*h1)) \ 60
  3466.       s1 = CInt(WMPCtrl.controls.currentPosition-(3600*h1)-(60*m1))
  3467.       h2 = WMPCtrl.currentMedia.duration \ 3600
  3468.       m2 = (WMPCtrl.currentMedia.duration-(3600*h2)) \ 60
  3469.       s2 = CInt(WMPCtrl.currentMedia.duration-(3600*h2)-(60*m2))
  3470.       If m1>=0 and m1<10 Then m1 = "0" & m1
  3471.       If s1>=0 and s1<10 Then s1 = "0" & s1
  3472.       If m2>=0 and m2<10 Then m2 = "0" & m2
  3473.       If s2>=0 and s2<10 Then s2 = "0" & s2
  3474.  
  3475.       If CInt(h2)>0 Then
  3476.         title = h1 &":"& m1 &":"& s1 &"/"& h2 &":"& m2 &":"& s2
  3477.       Else
  3478.         title = m1 &":"& s1 &" / "& m2 &":"& s2
  3479.       End If
  3480.       title = Left(title, 15)
  3481.       fma.debug title
  3482.       am.DlgPercent title, "mp9seek", 7 , curPos
  3483.       am.Back = "enterMediaPlayer"
  3484.     Else
  3485.       enterMediaPlayer
  3486.     End If
  3487.   Else
  3488.     enterMediaPlayer
  3489.   End If
  3490. End Sub
  3491.  
  3492. Sub mp9seekUpdate
  3493. dim curPos
  3494.   If (WMPplugin.Running)and(CurrentItem="mp9seek") Then
  3495.     curPos = (WMPCtrl.controls.currentPosition - ((Showbar-1)*60))\10
  3496.     If (curPos <> Pos)and((curPos <> 6)or(Cint(Right(CStr(CInt(WMPCtrl.controls.currentPosition)),1))=0)) Then mp9enterSeek
  3497.   Else
  3498.     deleteTimers
  3499.   End If
  3500. End Sub
  3501.  
  3502. Sub mp9seek(value, final)
  3503.   If (WMPplugin.Running) Then
  3504.     If (WMPCtrl.playState=2) or (WMPCtrl.playState=3) Then
  3505.       If final = 1 Then
  3506.         deleteTimers
  3507.         GotoMethod
  3508.       Else
  3509.         If (value=0)and(Showbar>1) Then
  3510.           WMPCtrl.controls.currentPosition = ((Showbar-1)*60) + Round(value*0.7, 0)
  3511.           mp9enterSeek
  3512.         ElseIf (value=100)and(Showbar<NeededBars) Then
  3513.           WMPCtrl.controls.currentPosition = ((Showbar-1)*60) + Round(value*0.7, 0)
  3514.           mp9enterSeek
  3515.         Else
  3516.           WMPCtrl.controls.currentPosition = ((Showbar-1)*60) + Round(value*0.7, 0)
  3517.           Pos = Round(value*0.7, 0) \ 10
  3518.         End If
  3519.       End If
  3520.     Else
  3521.       enterMediaPlayer
  3522.     End If
  3523.   Else
  3524.     enterMediaPlayer
  3525.   End If
  3526. End Sub
  3527.  
  3528. Sub mp9Playlists
  3529.   am.DlgFeedback "Loading...", "mediaPlayer"
  3530.   am.update
  3531.   mp9listPlaylists
  3532. End Sub
  3533.  
  3534. Sub mp9listPlaylists
  3535. dim i,j,k,s1,p
  3536.   p = Pos
  3537.   CurrentItem = "playlists"
  3538.   'fma.debug WMPCtrl.settings.mediaAccessRights
  3539.   j = WMPCtrl.playlistCollection.getAll.count
  3540.   If (j mod NrSongsOnPage<>0) Then k=j\NrSongsOnPage+1 Else k=j\NrSongsOnPage
  3541.   am.Clear
  3542.   If j<7 Then
  3543.     am.Title = Left("Playlists:" & j,15)
  3544.   Else
  3545.     am.Title = Left("Playlists " & p\NrSongsOnPage+1 & "/" & k,15)
  3546.   End If
  3547.   setItemPress("mp9PsClick")
  3548.   If j=0 Then
  3549.     am.AddItem "None available", "mediaPlayer"
  3550.   Else
  3551.     For i=0 to NrSongsOnPage-1
  3552.       If ( p+i < j) Then            'while there are still playlists to be shown
  3553.         s1 = Filter(WMPCtrl.playlistCollection.getAll.item(p+i).name)
  3554.         am.AddItem s1, "itemPress" & i
  3555.       Else                    'no songs to be shonwn
  3556.         Exit For
  3557.       End If
  3558.     Next
  3559.   End If
  3560.     am.Back = "mediaPlayer"
  3561.     am.NextState=2
  3562.     am.Update
  3563. End Sub
  3564.  
  3565. Sub mp9PsClick(i)
  3566.   WMPCtrl.currentPlaylist = WMPCtrl.playlistCollection.getAll.item(Pos+i)
  3567.   enterMediaPlayer
  3568. End Sub
  3569.  
  3570. Public WMPplaylist
  3571. Public WMPsearchSt
  3572. Public WMPsearchType
  3573. Public WMPsearchSubS
  3574. WMPsearchSubS = FALSE
  3575.  
  3576. Sub mp9currPlaylist
  3577. dim i,j,k,s1,p
  3578.   am.DlgFeedback "Loading...", "mediaPlayer"
  3579.   am.update
  3580.   WMPsearchSubS = FALSE
  3581.   Set WMPplaylist = WMPCtrl.currentPlaylist
  3582.   mp9browsePlaylist
  3583. End Sub
  3584.  
  3585. Sub mp9browsePlaylist
  3586. dim i,j,k,s1,p
  3587.   p = Pos
  3588.   CurrentItem = "currPlaylist"
  3589.   j = WMPplaylist.count
  3590.   If (j mod NrSongsOnPage<>0) Then k=j\NrSongsOnPage+1 Else k=j\NrSongsOnPage
  3591.   am.Clear
  3592.   If j<=NrSongsOnPage Then
  3593.     am.Title = Left("Items: " & j,15)
  3594.   Else
  3595.     am.Title = Left("Items " & p\NrSongsOnPage+1 & "/" & k,15)
  3596.   End If
  3597.   setItemPress("mp9PClick")
  3598.   If j=0 Then
  3599.     If WMPsearchSubS Then
  3600.       am.AddItem "No matches found", "mediaPlayer"
  3601.     Else
  3602.       am.AddItem "No EXACT matches", "mediaPlayer"
  3603.       am.AddItem "Continue search for NON-exact matches", "mp9bySubStr"
  3604.     End If
  3605.   Else
  3606.     For i=0 to NrSongsOnPage-1
  3607.       If ( p+i < j) Then            'while there are still songs to be shown
  3608.         s1 = Filter(WMPplaylist.item(p+i).name)
  3609.         If (WMPplaylist.item(p+i).getItemInfo("Artist")<>"") Then
  3610.           s1 = s1 & " - " & Filter(WMPplaylist.item(p+i).getItemInfo("Artist"))
  3611.         End If
  3612.         am.AddItem s1, "itemPress" & i
  3613.       Else                    'no songs to be shonwn
  3614.         Exit For
  3615.       End If
  3616.     Next
  3617.   End If
  3618.     am.Back = "mediaPlayer"
  3619.     am.NextState=2
  3620.     am.Update
  3621. End Sub
  3622.  
  3623. Sub mp9PClick(i)
  3624.   If (not (WMPCtrl.currentPlaylist.isIdentical(WMPplaylist))) Then
  3625.     WMPCtrl.currentPlaylist = WMPplaylist
  3626.   End If
  3627.   WMPCtrl.controls.currentItem = WMPplaylist.item(Pos+i)
  3628.   WMPCtrl.controls.play
  3629.   enterMediaPlayer
  3630. End Sub
  3631.  
  3632. Sub mp9LibrarySearch
  3633.   fma.DeleteTimer("mediaPlayerUpdate")
  3634.   WMPsearchSubS = FALSE
  3635.   CurrentItem = "mp9Search"
  3636.   Pos = 0
  3637.   am.Clear
  3638.   am.Title = "Search"
  3639.   am.AddItem "by Author", "mp9byAuthor"
  3640.   am.AddItem "by Title", "mp9byName"
  3641.   am.AddItem "by Album", "mp9byAlbum"
  3642.   am.AddItem "by Genre", "mp9byGenre"
  3643.   am.Back = "enterMediaPlayer"
  3644.   am.NextState=2
  3645.   am.Update
  3646. End Sub
  3647.  
  3648. Sub mp9byAuthor
  3649.   If (WMPplugin.Running) Then
  3650.     EnterTextBool = TRUE
  3651.     am.DlgInputStr "Search author","Author:",30,"","mp9Search1"
  3652.     am.NextState = 3
  3653.     am.Back = "mp9LibrarySearch"
  3654.   Else
  3655.     enterMediaPlayer
  3656.   End If
  3657. End Sub
  3658. Sub mp9byName
  3659.   If (WMPplugin.Running) Then
  3660.     EnterTextBool = TRUE
  3661.     am.DlgInputStr "Search item","Title:",30,"","mp9Search2"
  3662.     am.NextState = 3
  3663.     am.Back = "mp9LibrarySearch"
  3664.   Else
  3665.     enterMediaPlayer
  3666.   End If
  3667. End Sub
  3668. Sub mp9byAlbum
  3669.   If (WMPplugin.Running) Then
  3670.     EnterTextBool = TRUE
  3671.     am.DlgInputStr "Search album","Album:",30,"","mp9Search3"
  3672.     am.NextState = 3
  3673.     am.Back = "mp9LibrarySearch"
  3674.   Else
  3675.     enterMediaPlayer
  3676.   End If
  3677. End Sub
  3678. Sub mp9byGenre
  3679.   If (WMPplugin.Running) Then
  3680.     EnterTextBool = TRUE
  3681.     am.DlgInputStr "Search genre","Genre:",20,"","mp9Search4"
  3682.     am.NextState = 3
  3683.     am.Back = "mp9LibrarySearch"
  3684.   Else
  3685.     enterMediaPlayer
  3686.   End If
  3687. End Sub
  3688.  
  3689. Sub mp9bySubStr
  3690.   If (WMPplugin.Running) Then
  3691.     dim mItem,j,k
  3692.     WMPsearchSubS = TRUE
  3693.     am.DlgFeedback "Searching...", "mp9LibrarySearch"
  3694.     am.update
  3695.     Set WMPplaylist = WMPCtrl.mediaCollection.getAll
  3696.     k=0
  3697.     Do While k<WMPplaylist.count
  3698.       Set mItem = WMPplaylist.item(k)
  3699.       j = mItem.getItemInfo(WMPsearchType)
  3700.       If (InStr(1,j,WMPsearchSt,1)=0) or (InStr(1,j,WMPsearchSt,1)=Null) Then
  3701.         WMPplaylist.removeItem(mItem)
  3702.         k = k-1
  3703.       End If
  3704.       k = k+1
  3705.     Loop
  3706.     WMPplaylist.name = "'" & WMPsearchSt & "' search"
  3707.     mp9browsePlaylist
  3708.   Else
  3709.     enterMediaPlayer
  3710.   End If
  3711. End Sub
  3712.  
  3713. Sub mp9Search1(s)
  3714.   am.DlgFeedback "Searching...", "mp9LibrarySearch"
  3715.   am.update
  3716.   EnterTextBool = FALSE
  3717.   WMPsearchSt = s
  3718.   WMPsearchType = "Author"
  3719.   Set WMPplaylist = WMPCtrl.mediaCollection.getByAuthor(WMPsearchSt)
  3720.   mp9browsePlaylist
  3721. End Sub
  3722. Sub mp9Search2(s)
  3723.   am.DlgFeedback "Searching...", "mp9LibrarySearch"
  3724.   am.update
  3725.   EnterTextBool = FALSE
  3726.   WMPsearchSt = s
  3727.   WMPsearchType = "Title"
  3728.   Set WMPplaylist = WMPCtrl.mediaCollection.getByName(WMPsearchSt)
  3729.   mp9browsePlaylist
  3730. End Sub
  3731. Sub mp9Search3(s)
  3732.   am.DlgFeedback "Searching...", "mp9LibrarySearch"
  3733.   am.update
  3734.   EnterTextBool = FALSE
  3735.   WMPsearchSt = s
  3736.   WMPsearchType = "Album"
  3737.   Set WMPplaylist = WMPCtrl.mediaCollection.getByAlbum(WMPsearchSt)
  3738.   mp9browsePlaylist
  3739. End Sub
  3740. Sub mp9Search4(s)
  3741.   am.DlgFeedback "Searching...", "mp9LibrarySearch"
  3742.   am.update
  3743.   EnterTextBool = FALSE
  3744.   WMPsearchSt = s
  3745.   WMPsearchType = "Genre"
  3746.   Set WMPplaylist = WMPCtrl.mediaCollection.getByGenre(WMPsearchSt)
  3747.   mp9browsePlaylist
  3748. End Sub
  3749.  
  3750. Sub mp9Shuffle()
  3751.   WMPCtrl.settings.setMode "shuffle", not(WMPCtrl.settings.getMode("shuffle"))
  3752.   mediaPlayer
  3753. End Sub
  3754.  
  3755. Sub mp9Repeat()
  3756.   WMPCtrl.settings.setMode "loop", not (WMPCtrl.settings.getMode("loop"))
  3757.   mediaPlayer
  3758. End Sub
  3759.  
  3760. Sub mp9listJump(i)
  3761. dim j,k,l
  3762.   'fma.debug i
  3763.   EnterTextBool = TRUE
  3764.   If (i = 1) Then
  3765.     j = WMPCtrl.playlistCollection.getAll.count
  3766.     l = Pos\NrSongsOnPage+1
  3767.     If (j mod NrSongsOnPage<>0) Then k=j\NrSongsOnPage+1 Else k=j\NrSongsOnPage
  3768.     am.DlgInputInt "Jump to page", "Page (1 - " & k & "):", 1, k, l, "mp9list1"
  3769.   Else
  3770.     j = WMPplaylist.count
  3771.     l = Pos\NrSongsOnPage+1
  3772.     If (j mod NrSongsOnPage<>0) Then k=j\NrSongsOnPage+1 Else k=j\NrSongsOnPage
  3773.     am.DlgInputInt "Jump to page", "Page (1 - " & k & "):", 1, k, l, "mp9list2"
  3774.   End If
  3775.   am.NextState = 3
  3776.   If (i = 1) Then
  3777.     am.Back = "mp9listPlaylists"
  3778.   Else
  3779.     am.Back = "mp9browsePlaylist"
  3780.   End If
  3781. End Sub
  3782.  
  3783. Sub mp9list1(i)
  3784.   If (WMPplugin.Running) Then
  3785.     EnterTextBool = FALSE
  3786.     Pos = (i-1)*NrSongsOnPage
  3787.     mp9listPlaylists
  3788.   Else
  3789.     enterMediaPlayer
  3790.   End If
  3791. End Sub
  3792. Sub mp9list2(i)
  3793.   If (WMPplugin.Running) Then
  3794.     EnterTextBool = FALSE
  3795.     Pos = (i-1)*NrSongsOnPage
  3796.     mp9browsePlaylist
  3797.   Else
  3798.     enterMediaPlayer
  3799.   End If
  3800. End Sub
  3801.  
  3802. Sub mp9askEdit
  3803.   If (WMPCtrl.currentPlaylist.count>0) Then
  3804.     CurrentItem = "editItem"
  3805.     am.DlgYesNo "Edit current item?", "mp9edit1", 7
  3806.     am.NextState = 2
  3807.     am.Back = "enterMediaPlayer"
  3808.   End If
  3809. End Sub
  3810.  
  3811. Public editedMedia
  3812.  
  3813. Sub mp9edit1(r)
  3814. '  fma.debug r
  3815.   If (r=1) Then
  3816.     Set editedMedia = WMPCtrl.currentMedia
  3817.     am.DlgInputStr "Edit Item", "Author:", 40, Filter(WMPCtrl.currentMedia.getItemInfo("Author")), "mp9edit2"
  3818.     am.NextState = 2
  3819.     am.Back = "enterMediaPlayer"
  3820.   Else
  3821.     enterMediaPlayer
  3822.   End If
  3823. End Sub
  3824.  
  3825. Public NEWArtist
  3826. Public NEWTitle
  3827.  
  3828. Sub mp9edit2(s)
  3829.   NEWArtist = s
  3830.   am.DlgInputStr "Edit Item", "Title:", 35, Filter(WMPCtrl.currentMedia.getItemInfo("Title")), "mp9edit3"
  3831.   am.NextState = 3
  3832.   am.Back = "enterMediaPlayer"
  3833. End Sub
  3834.  
  3835. Sub mp9edit3(s)
  3836.   NEWTitle = s
  3837.   If (WMPplugin.Running) Then
  3838.     editedMedia.setItemInfo "Artist", NEWArtist
  3839.     editedMedia.setItemInfo "Title", NEWTitle
  3840.   End If
  3841.   enterMediaPlayer
  3842. End Sub
  3843.  
  3844. ' TODO : perhaps volume (with volume keys)
  3845. ' ------------------------------------------
  3846.  
  3847. Sub mp9Launch()
  3848. dim i
  3849.   If (WMPplugin.Running) Then
  3850.     enterMediaPlayer
  3851.   Else
  3852.     LaunchAppDlg
  3853.     WMPplugin.Open
  3854.     For i=1 to 8          'Tries 8 times each second if WMP is on
  3855.       fma.Sleep (1000)
  3856.       On Error Resume Next
  3857.       Set WMPplugin = CreateObject("WMPuICE.WMPApp")
  3858.       WMPCtrl = null
  3859.       Set WMPCtrl = WMPplugin.Core
  3860.       On Error GoTo 0
  3861.       If (not IsNull(WMPCtrl)) Then
  3862.         AppOpen = WMPplugin.Running
  3863.         fma.Sleep (100)
  3864.         Exit For
  3865.       End If
  3866.     Next
  3867.     If AppOpen Then
  3868.       Set WMPplugin = CreateObject("WMPuICE.WMPApp")    'without this lockups happended sometimes
  3869.       mediaPlayer
  3870.     Else
  3871.      am.DlgMsgBox "Application didn't respond...", 3
  3872.      onAMRoot
  3873.     End If
  3874.   End If
  3875. End Sub
  3876.  
  3877. Sub mp9Close()
  3878.   fma.DeleteTimer("mediaPlayerUpdate")
  3879.   If (WMPplugin.Running) Then
  3880.     CloseAppDlg
  3881.     WMPplugin.Close
  3882.     AppOpen = FALSE
  3883.   End If
  3884.   enterMediaPlayer
  3885. End Sub
  3886.  
  3887.  
  3888. '---------------------------- powerDVD 6.0 Control -------------------------
  3889. 'id=3
  3890.  
  3891. Public FullBool
  3892. FullBool  = FALSE
  3893.  
  3894.  
  3895. Sub ToggleFullBool()
  3896.   FullBool = Not FullBool
  3897.   GotoMethod
  3898. End Sub
  3899.  
  3900. Sub enterPowerDVD()
  3901.   AppOpen = shell.AppActivate("PowerDVD")
  3902.   am.Clear
  3903.   powerDVD
  3904. End Sub
  3905.  
  3906. Sub powerDVD()
  3907.   enterAppMenu(3)
  3908.  
  3909.   If (AppOpen) Then
  3910.     am.AddItem "Play", "powerDVDPlay"
  3911.     am.AddItem "Pause", "powerDVDPause"
  3912.     am.AddItem "Stop", "powerDVDStop"
  3913.  
  3914.     If powerDVDChapterVar = "Chapter"  Then  am.AddItem "- BW/FW Chapter -", "powerDVDsetChapter"
  3915.     If powerDVDChapterVar = "Jump" Then am.AddItem "- BW/FW Jump -", "powerDVDsetChapter"
  3916.     If powerDVDChapterVar = "Speed" Then am.AddItem "- BW/FW Speed -", "powerDVDsetChapter"
  3917.  
  3918.     If (FullBool) Then
  3919.     am.AddItem "- FS Mode ON -" , "ToggleFullBool"
  3920.       Else  am.AddItem "- FS Mode OFF -" , "ToggleFullBool"
  3921.     End If
  3922.  
  3923.     If (MyPhoneType(1)=3) Then
  3924.       am.AddItem "Capture Frame", "powerDVDCapture"
  3925.     End If
  3926.  
  3927.     am.AddItem "Audio Stream", "powerDVDAudio"
  3928.     am.AddItem "Subtitles", "powerDVDSubtitle"
  3929.     am.AddItem "Mute/UnMute", "powerDVDVolMute"
  3930.     am.AddItem "Full Screen", "powerDVDFull"
  3931.     am.AddItem "Set repeat", "powerDVDRepeat"
  3932.     am.AddItem "Close PowerDVD", "powerDVDClose"
  3933. '    am.AddItem "Jump forward", "powerDVDJumpFF"
  3934. '    am.AddItem "Jump back", "powerDVDJumpBack"
  3935. '    am.AddItem "Fast forward", "powerDVDFF"
  3936. '    am.AddItem "Rewind", "PowerDVDRew"
  3937.  
  3938.   Else
  3939.     am.AddItem "Launch PowerDVD", "powerDVDLaunch"
  3940.   End If
  3941.  
  3942.   am.Back = "onAMRoot"
  3943.   am.NextState=2
  3944.   am.Update
  3945. End Sub
  3946.  
  3947. Sub powerDVDsetChapter()
  3948.   If powerDVDChapterVar = "Chapter" Then
  3949.   powerDVDChapterVar = "Speed"
  3950.   Else
  3951.   If powerDVDChapterVar = "Speed" Then
  3952.   powerDVDChapterVar = "Jump"
  3953.   Else
  3954.   If powerDVDChapterVar= "Jump" Then
  3955.   powerDVDChapterVar = "Chapter"
  3956.   End If
  3957.   End If
  3958.   End If
  3959.   gotoMethod
  3960. End Sub
  3961.  
  3962.  
  3963. Public powerDVDChapterVar    'Chapter or Jump or Speed
  3964. powerDVDChapterVar = "Chapter"
  3965.  
  3966. Sub powerDVDLaunch()
  3967.   LaunchAppDlg
  3968. ' shell.Exec ProgramDir & "\RegionFree\RegionFree.exe" 'change this line
  3969.   shell.Exec RootEXE(3)
  3970.   AppOpen = TRUE
  3971.   powerDVD
  3972. End Sub
  3973. Sub powerDVDClose()
  3974.   CloseAppDlg
  3975. ' If shell.AppActivate("RegionFree Window Title") Then shell.SendKeys("Closing Hotkey") 'change this line
  3976.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("^x")
  3977.   AppOpen = FALSE
  3978.   powerDVD
  3979. End Sub
  3980.  
  3981. Sub powerDVDPlay()
  3982.     If (FullBool) Then
  3983.       shell.SendKeys("~")
  3984.     Else
  3985.       If shell.AppActivate("PowerDVD") Then shell.SendKeys("~")
  3986.     End If
  3987.   am.Update
  3988. End Sub
  3989. Sub powerDVDPause()
  3990.  If (FullBool) Then
  3991.    shell.SendKeys("{ }")
  3992.  Else
  3993.    If shell.AppActivate("PowerDVD") Then shell.SendKeys("{ }")
  3994.  End If
  3995.   am.Update
  3996. End Sub
  3997. Sub powerDVDStop()
  3998.  If (FullBool) Then
  3999.    shell.SendKeys("s")
  4000.  Else
  4001.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("s")
  4002.  End If
  4003.   am.Update
  4004. End Sub
  4005. Sub powerDVDChapterPrev()
  4006.  If (FullBool) Then
  4007.    shell.SendKeys("p")
  4008.  Else
  4009.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("p")
  4010.  End If
  4011.   am.Update
  4012. End Sub
  4013. Sub powerDVDChapterNext()
  4014.  If (FullBool) Then
  4015.    shell.SendKeys("n")
  4016.  Else
  4017.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("n")
  4018.  End If
  4019.   am.Update
  4020. End Sub
  4021. Sub powerDVDSubtitle()
  4022.  If (FullBool) Then
  4023.    shell.SendKeys("u")
  4024.  Else
  4025.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("u")
  4026.  End If
  4027.   am.Update
  4028. End Sub
  4029. Sub powerDVDRepeat()
  4030.  If (FullBool) Then
  4031.    shell.SendKeys("r")
  4032.  Else
  4033.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("r")
  4034.  End If
  4035.   am.Update
  4036. End Sub
  4037. Sub powerDVDStepPrev()
  4038.  If (FullBool) Then
  4039.    shell.SendKeys("^b")
  4040.  Else
  4041.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("^b")
  4042.  End If
  4043.  am.Update
  4044. End Sub
  4045. Sub powerDVDStepNext()
  4046.  If (FullBool) Then
  4047.    shell.SendKeys("t")
  4048.  Else
  4049.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("t")
  4050.  End If
  4051.   am.Update
  4052. End Sub
  4053. Sub powerDVDCapture()
  4054.  If (FullBool) Then
  4055.    shell.SendKeys("c")
  4056.  Else
  4057.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("c")
  4058.  End If
  4059.   am.Update
  4060. End Sub
  4061. Sub powerDVDAudio()
  4062.  If (FullBool) Then
  4063.    shell.SendKeys("h")
  4064.  Else
  4065.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("h")
  4066.  End If
  4067.   am.Update
  4068. End Sub
  4069. Sub powerDVDVolMute()
  4070.  If (FullBool) Then
  4071.    shell.SendKeys("q")
  4072.  Else
  4073.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("q")
  4074.   End If
  4075.   am.Update
  4076. End Sub
  4077. Sub powerDVDFull()
  4078.  If (FullBool) Then
  4079.    shell.SendKeys("z")
  4080.  Else
  4081.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("z")
  4082.   End If
  4083.   am.Update
  4084. End Sub
  4085. Sub powerDVDMinimize()
  4086.  If (FullBool) Then
  4087.    shell.SendKeys("^n")
  4088.  Else
  4089.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("^n")
  4090.  End If
  4091.   am.Update
  4092. End Sub
  4093. Sub PowerDVDJumpFF()
  4094.  If (FullBool) Then
  4095.    shell.SendKeys("{PgDn}")
  4096.  Else
  4097.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("{PgDn}")
  4098.  End If
  4099.   am.Update
  4100. End Sub
  4101. Sub powerDVDJumpRew()
  4102.  If (FullBool) Then
  4103.    shell.SendKeys("{PgUp}")
  4104.  Else
  4105.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("{PgUp}")
  4106.   End If
  4107.   am.Update
  4108. End Sub
  4109. Sub powerDVDFF()
  4110.  If (FullBool) Then
  4111.    shell.SendKeys("f")
  4112.  Else
  4113.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("f")
  4114.  End if
  4115.   am.Update
  4116. End Sub
  4117. Sub PowerDVDRew()
  4118.  If (FullBool) Then
  4119.    shell.SendKeys("b")
  4120.  Else
  4121.   If shell.AppActivate("PowerDVD") Then shell.SendKeys("b")
  4122.  End if
  4123.   am.Update
  4124. End Sub
  4125.  
  4126. '---------------------------- Begin WinDVD ------------------------------------
  4127. 'id=10
  4128.  
  4129.  
  4130. Sub enterWinDVD()
  4131.   AppOpen = shell.AppActivate("InterVideo WinDVD")
  4132.   am.Clear
  4133.   winDVD
  4134. End Sub
  4135.  
  4136. Sub winDVD
  4137.   enterAppMenu(10)
  4138.  
  4139.   If (AppOpen) Then
  4140.     am.AddItem "Play/Select", "winDVDPlay"
  4141.     am.AddItem "Pause", "winDVDPause"
  4142.     am.AddItem "Stop", "winDVDStop"
  4143.  
  4144.     If (ChapterBool) Then
  4145.       am.AddItem "- BW/FW Chapter -", "setChapter"
  4146.     Else
  4147.       am.AddItem "- BW/FF -", "setChapter"
  4148.     End If
  4149.     am.AddItem "Audio Stream", "winDVDAudio"
  4150.     am.AddItem "Subtitles", "winDVDSubtitle"
  4151.     am.AddItem "Mute/UnMute", "winDVDVolMute"
  4152.     am.AddItem "Full Screen", "winDVDFull"
  4153.  
  4154.     am.AddItem "Chapter", "winDVDChapter"
  4155.     am.AddItem "Playlist", "winDVDPlayList"
  4156.  
  4157.     am.AddItem "Speed Down", "winDVDSpeedDown"
  4158.     am.AddItem "Speed Up", "winDVDSpeedUp"
  4159.  
  4160.     am.AddItem "Step FW", "winDVDStepFW"
  4161.     am.AddItem "Step BW", "winDVDStepBW"
  4162.  
  4163.     am.AddItem "Main Menu", "winDVDMainMenu"
  4164.     am.AddItem "Go Up", "winDVDGoUp"
  4165.     am.AddItem "Go Down", "winDVDGoDown"
  4166.     am.AddItem "Go Left", "winDVDGoLeft"
  4167.     am.AddItem "Go Right", "winDVDGoRight"
  4168.  
  4169.     am.AddItem "Close", "winDVDClose"
  4170.   Else
  4171.     am.AddItem "Launch WinDVD", "winDVDLaunch"
  4172.   End If
  4173.  
  4174.   am.Back = "onAMRoot"
  4175.   am.NextState=2
  4176.   am.Update
  4177. End Sub
  4178.  
  4179. Public TempProg
  4180.  
  4181. Sub winDVDLaunch()
  4182.   'LaunchAppDlg
  4183.   TempProg = ProgramDir & "\InterVideo\DVD6\WinDVD.exe"
  4184.   shell.Exec TempProg
  4185.   AppOpen = TRUE
  4186.   winDVD
  4187. End Sub
  4188. Sub winDVDClose()
  4189.   CloseAppDlg
  4190.   If shell.AppActivate("InterVideo WinDVD") Then shell.SendKeys("x")
  4191.   AppOpen = FALSE
  4192.   winDVD
  4193. End Sub
  4194.  
  4195. Sub winDVDPlay
  4196.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("~")
  4197.  am.Update
  4198. End Sub
  4199. Sub winDVDPause
  4200.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("{ }")
  4201.  am.Update
  4202. End Sub
  4203. Sub winDVDAudio
  4204.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("a")
  4205.  am.Update
  4206. End Sub
  4207. Sub winDVDChapter
  4208.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("c")
  4209.  am.Update
  4210. End Sub
  4211. Sub winDVDFastForward
  4212.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("f")
  4213.  am.Update
  4214. End Sub
  4215. Sub winDVDRewind
  4216.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("r")
  4217.  am.Update
  4218. End Sub
  4219.  
  4220. Sub winDVDGoUp
  4221.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("{UP}")
  4222.  am.Update
  4223. End Sub
  4224. Sub winDVDGoDown
  4225.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("{DOWN}")
  4226.  am.Update
  4227. End Sub
  4228. Sub winDVDGoLeft
  4229.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("{LEFT}")
  4230.  am.Update
  4231. End Sub
  4232. Sub winDVDGoRight
  4233.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("{RIGHT}")
  4234.  am.Update
  4235. End Sub
  4236. Sub winDVDSelect
  4237.  If shell.AppActivate("InterVideo WinDVD") Then shell.SendKeys("~")
  4238.  am.Update
  4239. End Sub
  4240. Sub winDVDMainMenu
  4241.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("^m")
  4242.  am.Update
  4243. End Sub
  4244.  
  4245. Sub winDVDSpeedDown
  4246.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("^{LEFT}")
  4247.  am.Update
  4248. End Sub
  4249. Sub winDVDSpeedUp
  4250.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("^{RIGHT}")
  4251.  am.Update
  4252. End Sub
  4253. Sub winDVDPlayList
  4254.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("l")
  4255.  am.Update
  4256. End Sub
  4257. Sub winDVDStepFW
  4258.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("n")
  4259.  am.Update
  4260. End Sub
  4261. Sub winDVDStepBW
  4262.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("^n")
  4263.  am.Update
  4264. End Sub
  4265. Sub winDVDStop
  4266.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("{END}")
  4267.  am.Update
  4268. End Sub
  4269. Sub winDVDPrev
  4270.  if shell.AppActivate("InterVideo WinDVD")then shell.SendKeys("{PGUP}")
  4271.  am.Update
  4272. End Sub
  4273. Sub winDVDNext
  4274.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("{PGDN}")
  4275.  am.Update
  4276. End Sub
  4277. Sub winDVDSubtitle
  4278.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("s")
  4279.  am.Update
  4280. End Sub
  4281. Sub winDVDVolMute
  4282.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("m")
  4283.  am.Update
  4284. End Sub
  4285. Sub winDVDFull
  4286.  if shell.AppActivate("InterVideo WinDVD") then shell.SendKeys("z")
  4287.  am.Update
  4288. End Sub
  4289.  
  4290. '------------------------------ End WinDVD ------------------------------------
  4291.  
  4292.  
  4293. '----------------------------- Begin iTunes -----------------------------------
  4294. 'id=11
  4295.  
  4296. Sub enterITunes()
  4297.   AppOpen = shell.AppActivate("iTunes")
  4298.   am.Clear
  4299.   iTunes
  4300. End Sub
  4301.  
  4302. Sub iTunes
  4303.   enterAppMenu(11)
  4304.  
  4305.   If (AppOpen) Then
  4306.     am.AddItem "Play/Pause", "iTPlayPause"
  4307.     am.AddItem "Stop", "iTStop"
  4308.     am.AddItem "Vizualizer", "iTFullScreen"
  4309.     am.AddItem "Launch", "iTLaunch"
  4310.     am.AddItem "Close", "iTClose"
  4311.   Else
  4312.     am.AddItem "Launch iTunes", "iTunesLaunch"
  4313.   End If
  4314.  
  4315.   am.Back = "onAMRoot"
  4316.   am.NextState=2
  4317.   am.Update
  4318. End Sub
  4319.  
  4320. Sub iTunesLaunch()
  4321.   LaunchAppDlg
  4322.   shell.Exec RootEXE(11)
  4323.   AppOpen = TRUE
  4324.   iTunes
  4325. End Sub
  4326. Sub iTunesClose()
  4327.   CloseAppDlg
  4328.   If shell.AppActivate("iTunes") Then shell.SendKeys("%{F4}")
  4329.   AppOpen = FALSE
  4330.   iTunes
  4331. End Sub
  4332.  
  4333. Sub iTunesPlayPause
  4334.   if shell.AppActivate("iTunes") then shell.SendKeys(" ")
  4335.   am.Update
  4336. End Sub
  4337. Sub iTunesStop
  4338.   if shell.AppActivate("iTunes") then shell.SendKeys(" ")
  4339.   am.Update
  4340. End Sub
  4341. Sub iTunesPrev
  4342.   if shell.AppActivate("iTunes")then shell.SendKeys("^{LEFT}")
  4343.   am.Update
  4344. End Sub
  4345. Sub iTunesNext
  4346.   if shell.AppActivate("iTunes") then shell.SendKeys("^{RIGHT}")
  4347.   am.Update
  4348. End Sub
  4349. Sub iTunesFullScreen
  4350.   if shell.AppActivate("iTunes") then shell.SendKeys("^t")
  4351.   am.Update
  4352. End Sub
  4353.  
  4354.  
  4355. '------------------------------ End iTunes ------------------------------------
  4356.  
  4357.  
  4358. '---------------------------- PowerPoint Control ------------------------------
  4359. 'id=7
  4360. Sub enterPowerPoint()
  4361.   am.Clear
  4362.   enterAppMenu(7)
  4363.  
  4364.   am.AddItem "Start Show", "ppStartShow"
  4365.   am.AddItem "Next Slide", "ppNext"
  4366.   am.AddItem "Prev Slide", "ppPrev"
  4367.   am.AddItem "Toggle Screen", "ppScreen"
  4368.   am.AddItem "End Show", "ppEndShow"
  4369.  
  4370.   am.Back = "onAMRoot"
  4371.   am.NextState=2
  4372.   am.Update
  4373. End Sub
  4374.  
  4375. Sub ppStartShow()
  4376.   If shell.AppActivate("Microsoft PowerPoint") Then shell.SendKeys("{F5}")
  4377.   am.Update
  4378. End Sub
  4379. Sub ppNext()
  4380.   shell.SendKeys("{DOWN}")
  4381.   am.Update
  4382. End Sub
  4383. Sub ppPrev()
  4384.   shell.SendKeys("{UP}")
  4385.   am.Update
  4386. End Sub
  4387. Sub ppScreen
  4388.     shell.SendKeys(".")
  4389.     am.Update
  4390. End Sub
  4391. Sub ppEndShow()
  4392.   shell.SendKeys("{ESC}")
  4393.   am.Update
  4394. End Sub
  4395.  
  4396.  
  4397. '---------------------------- Misc Control ------------------------------------
  4398. 'id=8
  4399. Sub enterMiscControl()
  4400.   am.Clear
  4401.   enterAppMenu(8)
  4402.  
  4403.   am.Title = "Misc"
  4404.   am.AddItem "Lock PC", "lockWorkStation"
  4405.   am.AddItem "Disconnect ME", "disconnectME"
  4406.   am.AddItem "Shutdown Menu", "shutdownMenu"
  4407.  
  4408.   am.Back = "onAMRoot"
  4409.   am.NextState=2
  4410.   am.Update
  4411. End Sub
  4412.  
  4413. Sub lockWorkStation()
  4414.   shell.Exec "Rundll32.exe user32.dll,LockWorkStation"
  4415.   am.Title = "PC locked"
  4416.   am.NextState=2
  4417.   am.Update
  4418. End Sub
  4419. Sub disconnectME()
  4420.   fma.Disconnect
  4421. End Sub
  4422. Sub shutdownMenu()
  4423.   CurrentItem = "shutdownMenu"
  4424.  
  4425.   am.Clear
  4426.   am.Title = "Shutdown PC"
  4427.   am.AddItem "Monitor OFF", "monitorof"
  4428.   am.AddItem "Monitor ON", "monitoron"
  4429.   am.AddItem "Shutdown", "shutdown"
  4430.   am.AddItem "Hibernate", "hibernate"
  4431.   am.AddItem "Reboot", "reboot"
  4432.   If (ShutdownBool) Then am.AddItem "Cancel Shutdown", "cancelShutdown"
  4433.  
  4434.   am.Back = "enterMiscControl"
  4435.   am.NextState=2
  4436.   am.Update
  4437. End Sub
  4438.  
  4439. Public ShutdownBool
  4440. ShutdownBool = FALSE
  4441.  
  4442. Sub shutdown()
  4443.   ShutdownBool = TRUE
  4444.   am.Clear
  4445.   shell.Exec "shutdown -f -s -t 30"
  4446.   am.Title = "Shutdown.."
  4447.   am.AddItem center("Cancel reboot",""), "cancelShutdown"
  4448.  
  4449.   am.Back = "shutdownMenu"
  4450.   am.NextState=2
  4451.   am.Update
  4452. End Sub
  4453.  
  4454. Sub hibernate
  4455.     shell.Run "Rundll32.exe powrprof.dll,SetSuspendState"
  4456. End Sub
  4457.  
  4458. Sub reboot()
  4459.   ShutdownBool = TRUE
  4460.   am.Clear
  4461.   shell.Exec "shutdown -f -r -t 30"
  4462.   am.Title = "Reboot.."
  4463.   am.AddItem center("Cancel reboot",""), "cancelShutdown"
  4464.  
  4465.   am.Back = "shutdownMenu"
  4466.   am.NextState=2
  4467.   am.Update
  4468. End Sub
  4469. Sub cancelShutdown()
  4470.   ShutdownBool = FALSE
  4471.  
  4472.   am.Clear
  4473.   shell.Exec "shutdown.exe -a"
  4474.   am.Title = "Canceled"
  4475.   am.AddItem center("Shutdown Menu",""), "shutdownMenu"
  4476.  
  4477.   am.Back = "shutdownMenu"
  4478.   am.NextState=2
  4479.   am.Update
  4480. End Sub
  4481. Sub monitorof
  4482.  am.Clear
  4483.   shell.Exec fmadir & "\sframework\helper\moncloser 0"
  4484.   am.Title = "Monitor OFF"
  4485.    am.AddItem center("Back to shutdownMenu",""), "shutdownMenu"
  4486.  
  4487.   am.Back = "shutdownMenu"
  4488.   am.NextState=2
  4489.   am.Update
  4490.   End Sub
  4491. Sub monitoron
  4492.  am.Clear
  4493.   shell.Exec fmadir & "\sframework\helper\moncloser 1"
  4494.      am.Title = "Monitor ON"
  4495.    am.AddItem center("Back to shutdownMenu",""), "shutdownMenu"
  4496.  
  4497.   am.Back = "shutdownMenu"
  4498.   am.NextState=2
  4499.   am.Update
  4500. End Sub
  4501. '---------------------------- user-settings menu ------------------------------
  4502.  
  4503. Function checkBox(b)
  4504.   If (b) Then        'TRUE set checkbox
  4505.     checkBox = "[*] "
  4506.     Exit Function
  4507.   Else            'FALSE
  4508.     checkBox = "[" & Space(SpaceOption) & "] "
  4509.     Exit Function
  4510.   End If
  4511. End Function
  4512.  
  4513. Sub enterSettings()
  4514.   setGotoMethod("enterSettings")
  4515.   am.Clear
  4516.   settingsMain
  4517. End Sub
  4518.  
  4519.  
  4520. Sub settingsMain()
  4521.   CurrentID = "settings"
  4522.   CurrentItem = "menu"
  4523.  
  4524.   am.ClearMenu
  4525.   am.Title = "Main settings"
  4526.  
  4527.   If (SettingMuteOnCall = 0) Then
  4528.     am.AddItem checkBox(FALSE) & center("On call",""), "setMuteOnCall"
  4529.     am.AddItem center("Mute",""), "settingsMain"
  4530.   ElseIf (SettingMuteOnCall = 1) Then
  4531.     am.AddItem checkBox(TRUE) & center("On call",""), "setMuteOnCall"
  4532.     am.AddItem center("Mute",""), "settingsMain"
  4533.   ElseIf (SettingMuteOnCall = 2) Then
  4534.     am.AddItem checkBox(TRUE) & center("On call",""), "setMuteOnCall"
  4535.     am.AddItem center("Decrease vol: " & OnCallDecreaseValue & "%",""), "onCallVol"
  4536.   Else '3
  4537.     am.AddItem checkBox(TRUE) & center("On call",""), "setMuteOnCall"
  4538.     am.AddItem center("Pause Winamp",""), "settingsMain"
  4539.   End If
  4540.   am.AddItem "Playlist: " & NrSongsOnPage & " items per page", "setNrOfSongs"
  4541.   am.AddItem checkBox(SettingStartOnConnect) & "Auto start", "setStartOnConnect"
  4542.   am.AddItem checkBox(SaveSettingsBool) & "Save settings", "setSaveSettings"
  4543.  
  4544.   If (MyPhoneType(1)=1) Then
  4545.     am.AddItem center("[SE T610]",""), "setMyPhoneType"
  4546.   ElseIf (MyPhoneType(1)=2) Then
  4547.     am.AddItem center("[SE K700i]",""), "setMyPhoneType"
  4548.   ElseIf (MyPhoneType(1)=3) Then
  4549.     am.AddItem center("[SE T68i]",""), "setMyPhoneType"
  4550.   End If
  4551.  
  4552.   am.AddItem MenuItemExitMenu, "exitSettings"
  4553.  
  4554.   am.Back = "exitSettings"
  4555.   am.NextState=2
  4556.   am.Update
  4557. End Sub
  4558.  
  4559. Sub onCallVol()
  4560.   CurrentItem = "volumeslide"
  4561.   am.DlgPercent "Decrease with", "onCallVolEvent", 10 , OnCallDecreaseValue/10
  4562.   am.Back = "enterSettings"
  4563. End Sub
  4564.  
  4565. Sub onCallVolEvent(value, final)
  4566.   OnCallDecreaseValue = value
  4567.   If final = 1 Then enterSettings
  4568. End Sub
  4569.  
  4570. Sub exitSettings()
  4571.   If (SaveSettingsBool) Then
  4572.     saveSettings
  4573.   Else
  4574.     deleteSettings
  4575.   End If
  4576.   onAMRoot
  4577. End Sub
  4578.  
  4579. Sub addRootItem(id)
  4580.   addElement id, RootItems
  4581. End Sub
  4582.  
  4583.  
  4584. Sub setMuteOnCall()
  4585.   SettingMuteOnCall = (SettingMuteOnCall+1) Mod 4            'Mute on Call
  4586.   settingsMain
  4587. End Sub
  4588. Sub setNrOfSongs()
  4589.   EnterTextBool = TRUE
  4590.   am.DlgInputInt "Items/page", "Items (2-10):", 2, 10, 6, "setNrOfSongs2"
  4591.   am.NextState = 3
  4592.   am.Back = "settingsMain"
  4593. End Sub
  4594. Sub setNrOfSongs2(i)
  4595.   NrSongsOnPage = i
  4596.   settingsMain
  4597. End Sub
  4598. Sub setStartOnConnect()
  4599.   SettingStartOnConnect = Not SettingStartOnConnect
  4600.   settingsMain
  4601. End Sub
  4602. Sub setSaveSettings()
  4603.   SaveSettingsBool = Not SaveSettingsBool
  4604.   settingsMain
  4605. End Sub
  4606.  
  4607. Sub setMyPhoneType()
  4608.   If (MyPhoneType(1)=MyPhoneType(0)) Then MyPhoneType(1)=1 Else MyPhoneType(1)=MyPhoneType(1)+1
  4609.   setPhone
  4610.   settingsMain
  4611. End Sub
  4612.  
  4613. '------------------------------------ menu config ----------------------------------------
  4614.  
  4615. Sub orderRoot()
  4616.   enterOrderMenu RootItems, RootID
  4617. End Sub
  4618. Sub selectRoot()
  4619.   enterSelectMenu RootItems, RootID
  4620. End Sub
  4621.  
  4622. Sub enterSelectMenu(a1,a2)
  4623.   am.Clear
  4624.   CurrentID = "settings"
  4625.   CurrentItem = "select"
  4626.  
  4627.   TempArray = a1
  4628.   TempArray2 = a2
  4629.   selectMenu a1, a2
  4630. End Sub
  4631.  
  4632.  
  4633. Sub selectMenu(a1,a2)          'a1 contains a selection of sorted indexes from a2 which denotes all available items
  4634.   Dim i, b, e
  4635.   am.ClearMenu
  4636.   am.Title = "Menulist [1/2]"
  4637.  
  4638.   setItemPress("toggleOption")
  4639.  
  4640.   For i=0 To UBound(a2)        'all elements
  4641.     b = FALSE
  4642.     For Each e In a1        'sorted indexes
  4643.       If (a2(i,0)=e) Then
  4644.         b = TRUE
  4645.         Exit For
  4646.       End If
  4647.     Next
  4648.     am.AddItem checkBox(b) & a2(i,1), "itemPress" & i
  4649.   Next
  4650.  
  4651.   am.Back = "exitSettings"
  4652.   am.NextState=2
  4653.   am.Update
  4654. End Sub
  4655.  
  4656. Sub toggleOption(i) 'index in all available items
  4657.   Dim e
  4658.   If (elementOf(i,TempArray)) Then
  4659.     removeElement i, TempArray    'remove element from sorted TempArray
  4660.   Else
  4661.     addElement i, TempArray    'add element to sorted TempArray
  4662.   End If
  4663.   saveArray
  4664.   selectMenu TempArray, TempArray2
  4665. End Sub
  4666.  
  4667. Sub enterOrderMenu(a1,a2)
  4668.   CurrentID = "settings"
  4669.   CurrentItem = "order"
  4670.  
  4671.   TempArray = a1
  4672.   TempArray2 = a2
  4673.  
  4674.   SelectItem = 1        'set SelectItem to a proper value
  4675.   orderMenu a1
  4676. End Sub
  4677.  
  4678. Sub orderMenu(arr)        'arr contains selected sorted indexes of all available items in TempArray
  4679.   Dim i, limit
  4680.   am.Clear
  4681.   am.Selected = SelectItem
  4682.   limit = UBound(arr)
  4683.  
  4684.   If (limit = 0) Then
  4685.     am.Title = "No items"
  4686.     am.AddItem "Select items", "gotoSelect"
  4687.   ElseIf (limit = 1) Then        'too few
  4688.     am.Title = "Select more"
  4689.     am.AddItem "Select items", "gotoSelect"
  4690.   Else
  4691.     am.Title = "Set order [2/2]"
  4692.  
  4693.     setItemPress("moveItemUp")
  4694.     For i=0 To limit                    'sorted selection menu-array
  4695.       am.AddItem TempArray2(arr(i),1), "itemPress" & i    'name
  4696.     Next
  4697.   End If
  4698.  
  4699.   am.Back = "exitSettings"
  4700.   am.NextState=2
  4701.   am.Update
  4702. End Sub
  4703.  
  4704. Sub moveItemUp(i)    'index in arr of which item to be moved  assumed i< ubound(TempArray = arr)
  4705.   Dim e
  4706.                       'TempArray set on enterOrderMenu
  4707.   If (i=0) Then                '1st item list
  4708.     e = TempArray(0)
  4709.     removeElementAt 0, TempArray    'first element
  4710.     addElement e, TempArray        'add to end
  4711.     SelectItem = UBound(TempArray)+1    'goto end of list
  4712.   Else                    'not 1st item on list
  4713.     e = TempArray(i-1)
  4714.     TempArray(i-1) = TempArray(i)
  4715.     TempArray(i) = e
  4716.     SelectItem = i
  4717.   End If
  4718.   saveArray
  4719.   orderMenu TempArray
  4720. End Sub
  4721.  
  4722.  
  4723. '---------------------------- Mouse Control -----------------------------
  4724.  
  4725. Sub enterMouseControl
  4726.   EnterTextBool = FALSE
  4727.   am.NextState = 2
  4728.  
  4729.   am.DlgMsgBox "Mouse Control", 0
  4730.   EnableMouseControl = 1
  4731. End Sub
  4732.  
  4733. Sub enterText
  4734.   EnterTextBool = TRUE
  4735.   am.DlgInputStr "Input","Text:",40,"","enterTextEvent"
  4736.   am.NextState = 2
  4737.   am.Back = "enterMouseControl"
  4738. End Sub
  4739.  
  4740. Public EnterTextBool
  4741.  
  4742. Sub enterTextEvent(s)     'send entered string
  4743.   shell.SendKeys s
  4744.   enterMouseControl
  4745. End Sub
  4746.  
  4747. Sub mouseControlFinish    'end mouse control
  4748.   MouseCtrl.MouseStop
  4749.   EnableMouseControl = 0  'disable mouse control
  4750.   onAMRoot
  4751. End Sub
  4752.  
  4753. Sub mouseControlEvent(button, state)
  4754.   If state = 0 Then
  4755.     MouseCtrl.MouseStop
  4756.   ElseIf (Not EnterTextBool) Then
  4757.     Select Case button
  4758.       Case BackButton mouseControlFinish    'T610
  4759.  
  4760.       Case "<"  MouseCtrl.MouseMove("W")
  4761.       Case "^"  MouseCtrl.MouseMove("N")
  4762.       Case ">"  MouseCtrl.MouseMove("E")
  4763.       Case "v"  MouseCtrl.MouseMove("S")
  4764.  
  4765.       Case "s"  MouseCtrl.MouseLeftClick        't68i
  4766.       Case ":J" MouseCtrl.MouseLeftClick        'T610
  4767.  
  4768.       Case "*"  enterText
  4769.       Case "#"  shell.SendKeys("{enter}")
  4770.       Case "c"  shell.SendKeys("{backspace}")
  4771.  
  4772.       Case "["  MouseCtrl.MouseLeftClick    'T610
  4773.       Case "]"  MouseCtrl.MouseRightClick
  4774.  
  4775.       Case "5"  MouseCtrl.MouseLeftClick    't68i
  4776.       Case "0"  MouseCtrl.MouseRightClick
  4777.  
  4778.       Case "u"  MouseCtrl.MouseWhlUp
  4779.       Case "d"  MouseCtrl.MouseWhlDown
  4780.  
  4781.       Case "1"  MouseCtrl.MouseMove("NW")
  4782.       Case "2"  MouseCtrl.MouseMove("N")
  4783.       Case "3"  MouseCtrl.MouseMove("NE")
  4784.       Case "4"  MouseCtrl.MouseMove("W")
  4785.       Case "6"  MouseCtrl.MouseMove("E")
  4786.       Case "7"  MouseCtrl.MouseMove("SW")
  4787.       Case "8"  MouseCtrl.MouseMove("S")
  4788.       Case "9"  MouseCtrl.MouseMove("SE")
  4789.     End Select
  4790.   End If
  4791. End Sub
  4792.  
  4793. '------------------------ End Mouse Control -----------------------------
  4794. '------------------ FMA Menu calling from mainmenu ----------------------
  4795. Public remoteMenuEnter
  4796. Public remoteMenuExit
  4797.  
  4798. Sub remoteMenuStart
  4799.   'fma.debug "# start"
  4800.   remoteMenuEnter = FALSE
  4801.   remoteMenuExit = FALSE
  4802.   fma.AddTimer 2000, "remoteMenuTimer"
  4803. End Sub
  4804.  
  4805. Sub remoteMenuStop
  4806.   'fma.debug "# stop"
  4807.   remoteMenuExit = TRUE
  4808.   If (remoteMenuEnter) Then
  4809.     Transmit "AT*EAST=" & Chr(34) & "Fma Remote" & Chr(34)
  4810.     onAMRoot
  4811.   End If
  4812. End Sub
  4813.  
  4814. Sub remoteMenuTimer
  4815.   fma.DeleteTimer "remoteMenuTimer"
  4816.   If not remoteMenuExit Then
  4817.     remoteMenuEnter = TRUE
  4818.     Transmit "AT*EAST=" & Chr(34) & "FMA Remote" & Chr(34)
  4819.   End If
  4820. End Sub
  4821. '----------------- End FMA Menu calling from mainmenu ----------------------
  4822. '------------------------- keyevent procedures -----------------------------
  4823. ' seems that there's a problem with recognizing released key, i had to workaround it //mhr
  4824.  
  4825. Public lastPressedKey
  4826.  
  4827. Sub OnKeyPress(button, state)                'state=1 :pressed    state=0 :released
  4828. 'fma.debug CurrentID & ":" & CurrentItem
  4829. 'fma.debug GotoMethodValue
  4830. 'fma.debug button & " - " & state
  4831.  
  4832.   If state = 1 Then LastPressedKey = button
  4833.   fma.ClearKey
  4834.   If EnableMouseControl = 1 Then
  4835.     mouseControlEvent button, state
  4836.   ElseIf (EnableKeys) Then
  4837.     If (state = 1) Then
  4838.       Select Case button
  4839.         Case "u"
  4840.           deleteTimers
  4841.           volumeKeysEvent("u")
  4842.         Case "d"
  4843.           deleteTimers
  4844.           volumeKeysEvent("d")
  4845.         Case OptionButton
  4846.           optionKeyEvent
  4847.         Case Else                    'no volume or option key pressed
  4848.           Select Case CurrentID
  4849.             Case RootID(0,0)        'wintv
  4850.               Select Case CurrentItem
  4851.                 Case "menu"  WinTVKeyEvent button, state
  4852.                 Case "channelList"  channelKeyEvent button, state
  4853.               End Select
  4854.  
  4855.             Case RootID(1,0)        'more tv
  4856.               Select Case CurrentItem
  4857.                 Case "menu"  MoreTVKeyEvent button, state
  4858.                 Case "channelList"  channelKeyEvent button, state
  4859.               End Select
  4860.  
  4861.             Case RootID(2,0)  winampKeyEvent button, state       'winamp
  4862.             Case RootID(3,0)  powerDVDKeyEvent button, state     'powerdvd
  4863.             Case RootID(4,0)  bsPlayerKeyEvent button, state     'bsplayer
  4864.             Case RootID(5,0)  mediaPlayerKeyEvent button, state  'mediaplayer
  4865.             Case RootID(10,0) winDVDKeyEvent button, state  'WinDVD
  4866.             Case RootID(11,0) iTunesKeyEvent button, state  'iTunes
  4867.  
  4868.             Case RootID(12,0)        'DScaler
  4869.               Select Case CurrentItem
  4870.                 Case "menu"  DScalerKeyEvent button, state
  4871.                 Case "channelList"  channelKeyEvent button, state
  4872.               End Select
  4873.  
  4874.             Case RootID(13,0) zoomPlayerKeyEvent button, state  'Zoom Player
  4875.             Case RootID(14,0)
  4876.               Select Case CurrentItem
  4877.                 Case "browseOption"  exitBrowseOption
  4878.                 Case Else            browseKeyEvent button, state
  4879.               End Select
  4880.             Case RootID(15,0) iexploreKeyEvent button, state  'iexplore
  4881.             Case RootID(16,0) RadLightKeyEvent button, state
  4882.  
  4883.             Case "settings"  settingsKeyEvent button, state
  4884.           End Select
  4885.       End Select
  4886.     End If
  4887.   ElseIf (button = "#")or(lastPressedKey = "#") Then
  4888.     Select Case state
  4889.       Case 1 remoteMenuStart
  4890.       Case 0 remoteMenuStop
  4891.     End Select
  4892.   End If
  4893. End Sub
  4894.  
  4895. Sub optionKeyEvent()        'option events
  4896.   Select Case CurrentID
  4897.     Case RootID(2,0)        'winamp
  4898.       Select Case CurrentItem
  4899.         Case "playlist"      'enter playlist options
  4900.            deleteTimers      'delete dynamic update timers
  4901.            playlistOptions
  4902.         Case "winampSearch"        '#########
  4903.         Case "searchInput"        '#########
  4904.         Case "select"  onAMRoot
  4905.         Case "order"   onAMRoot
  4906.         Case "songInfo"            '#########
  4907.         Case "songInfo2"        '#########
  4908.         Case "gotoSong"            '#########
  4909.         Case "simpleSearch"        '#########
  4910.         Case "playlistOptions"          PlayList LastArg1
  4911.  
  4912.         Case Else
  4913.           Select Case CurrentItem
  4914.             Case "options"  gotoMethod
  4915.             Case "selectPlaylist"
  4916.             Case Else            'enter general winamp options
  4917.               deleteTimers       'delete dynamic update timers
  4918.               enterWinampOptions
  4919.           End Select
  4920.       End Select
  4921.  
  4922.     Case RootID(5,0)
  4923.       Select Case CurrentItem
  4924.         Case "menu"   mp9askEdit
  4925.       End Select
  4926.  
  4927.     Case RootID(14,0)
  4928.       Select Case CurrentItem
  4929.         Case "browse"   browseOption
  4930.         Case "browseOption"  exitBrowseOption
  4931.       End Select
  4932.  
  4933.     Case "settings"
  4934.       Select Case CurrentItem
  4935.         Case "select"  onAMRoot
  4936.         Case "order"   onAMRoot
  4937.       End Select
  4938.     Case "onAMRoot"  gotoSelect
  4939.   End Select
  4940. End Sub
  4941.  
  4942. Sub gotoSelect                 'enter menuitems-selection
  4943.   setGotoMethod("gotoSelect")
  4944.   selectRoot
  4945. End Sub
  4946.  
  4947. Sub gotoOrder                  'enter menuitems-order
  4948.   setGotoMethod("gotoOrder")
  4949.   orderRoot
  4950. End Sub
  4951.  
  4952. Sub settingsKeyEvent(button, state)   'key events within select-order config menu
  4953.   Select Case CurrentItem
  4954.     Case "select"
  4955.       Select Case button
  4956.         Case ">"  gotoOrder
  4957.       End Select
  4958.     Case "order"
  4959.       Select Case button
  4960.         Case "<"  gotoSelect
  4961.       End Select
  4962.   End Select
  4963. End Sub
  4964.  
  4965. 'id=14
  4966. Sub browseKeyEvent(button, state)
  4967.   If (CurrentItem <> "volumeslide") Then
  4968.   Select Case button
  4969.       Case "c"
  4970.         If (IsRoot) Then
  4971.             browseDrives
  4972.         Else
  4973.           browseUp
  4974.         End If
  4975.       Case ">"
  4976.         nextBrowse
  4977.       Case "<"
  4978.         prevBrowse
  4979.   End Select
  4980.   End If
  4981. End Sub
  4982.  
  4983. Sub volumeKeysEvent(s)
  4984.   Select Case CurrentID
  4985.     Case RootID(2,0)            'within winamp
  4986.       If (CurrentItem <> "volumeslide") Then  winampSlideVol
  4987.     Case RootID(15,0)            'internet explorer
  4988.       If (AppOpen) and (CurrentItem <> "volumeslide") and (s="u") Then
  4989.         IEtabB
  4990.       ElseIf (AppOpen) and (CurrentItem <> "volumeslide") and (s="d") Then
  4991.         IEtabF
  4992.       End If
  4993.     Case Else                    'not in winamp
  4994.       If (CurrentItem <> "volumeslide") Then  masterVol
  4995.   End Select
  4996. End Sub
  4997.  
  4998.  
  4999. '---------------- apps key events -------------------
  5000. 'id=0
  5001. Sub WinTVKeyEvent(button, state)
  5002.   Select Case CurrentItem
  5003.     Case "menu"
  5004.       Select Case button
  5005.         Case ">"  winTVChannelUp
  5006.         Case "<"  winTVChannelDown
  5007.         Case CameraButton winTVSnapShot
  5008.       End Select
  5009.   End Select
  5010. End Sub
  5011.  
  5012. 'id=1
  5013. Sub MoreTVKeyEvent(button, state)
  5014.   Select Case CurrentItem
  5015.     Case "menu"
  5016.       Select Case button
  5017.         Case ">"  moreTVChannelUp
  5018.         Case "<"  moreTVChannelDown
  5019.       End Select
  5020.   End Select
  5021. End Sub
  5022.  
  5023. 'id=12
  5024. Sub DScalerKeyEvent(button, state)
  5025.   Select Case CurrentItem
  5026.     Case "menu"
  5027.       Select Case button
  5028.         Case ">"  dScalerChannelUp
  5029.         Case "<"  dScalerChannelDown
  5030.         Case CameraButton dScalerSnapShot
  5031.       End Select
  5032.   End Select
  5033. End Sub
  5034.  
  5035. Sub channelKeyEvent(button, state)       'channel events (tv programs)
  5036.   Select Case button
  5037.     Case "0"  channel0
  5038.     Case "1"  channel1
  5039.     Case "2"  channel2
  5040.     Case "3"  channel3
  5041.     Case "4"  channel4
  5042.     Case "5"  channel5
  5043.     Case "6"  channel6
  5044.     Case "7"  channel7
  5045.     Case "8"  channel8
  5046.     Case "9"  channel9
  5047.   End Select
  5048. End Sub
  5049.  
  5050. 'id=3
  5051. Sub powerDVDKeyEvent(button, state)
  5052.   Select Case CurrentItem
  5053.     Case "menu"
  5054.       Select Case button
  5055.         Case ">"
  5056.           If powerDVDChapterVar = "Chapter" Then
  5057.           powerDVDChapterNext
  5058.           Else
  5059.           If powerDVDChapterVar = "Step" Then
  5060.           powerDVDStepNext
  5061.           Else
  5062.           If powerDVDChapterVar = "Jump" Then
  5063.           powerDVDJumpFF
  5064.           Else
  5065.           If powerDVDChapterVar = "Speed" Then
  5066.           PowerDVDFF
  5067.           End If
  5068.           End If
  5069.           End If
  5070.           End If
  5071.         Case "<"
  5072.         If powerDVDChapterVar = "Chapter" Then
  5073.           powerDVDChapterPrev
  5074.           Else
  5075.           If powerDVDChapterVar = "Step" Then
  5076.           powerDVDStepPrev
  5077.           Else
  5078.           If powerDVDChapterVar = "Jump" Then
  5079.           powerDVDJumpRew
  5080.           Else
  5081.           If powerDVDChapterVar = "Speed" Then
  5082.           PowerDVDRew
  5083.           End If
  5084.           End If
  5085.           End If
  5086.           End If
  5087.       End Select
  5088.   End Select
  5089. End Sub
  5090.  
  5091. 'id=4
  5092. Sub bsPlayerKeyEvent(button, state)
  5093.   Select Case CurrentItem
  5094.     Case "menu"
  5095.       Select Case button
  5096.         Case ">"  bsPlayerNext
  5097.         Case "<"  bsPlayerPrev
  5098.       End Select
  5099.    End Select
  5100. End Sub
  5101.  
  5102. 'id=5
  5103. Sub mediaPlayerKeyEvent(button, state)
  5104. dim j
  5105.   Select Case CurrentItem
  5106.     Case "menu"
  5107.       Select Case button
  5108.         Case ">"  mp9NextItem
  5109.         Case "<"  mp9PrevItem
  5110.         Case Else
  5111.       End Select
  5112.     Case "playlists"
  5113.       Select Case button
  5114.         Case ">"
  5115.           If (Pos+NrSongsOnPage>=WMPCtrl.playlistCollection.getAll.count) Then
  5116.             Pos = 0
  5117.           Else
  5118.             Pos = Pos + NrSongsOnPage
  5119.           End If
  5120.           mp9listPlaylists
  5121.         Case "<"
  5122.           If (Pos-NrSongsOnPage<0) Then
  5123.             Pos = ((WMPCtrl.playlistCollection.getAll.count-1)\NrSongsOnPage)*NrSongsOnPage
  5124.           Else
  5125.             Pos = Pos - NrSongsOnPage
  5126.           End If
  5127.           mp9listPlaylists
  5128.         Case "#"
  5129.           j = WMPCtrl.playlistCollection.getAll.count    ' doesnt work, i have no idea why //mhr
  5130.           If (j>NrSongsOnPage) Then
  5131.             mp9listJump 1
  5132.           End If
  5133.         Case Else
  5134.       End Select
  5135.     Case "currPlaylist"
  5136.       Select Case button
  5137.         Case ">"
  5138.           If (Pos+NrSongsOnPage>=WMPplaylist.count) Then
  5139.             Pos = 0
  5140.           Else
  5141.             Pos = Pos + NrSongsOnPage
  5142.           End If
  5143.           mp9browsePlaylist
  5144.         Case "<"
  5145.           If (Pos-NrSongsOnPage<0) Then
  5146.             Pos = ((WMPplaylist.count-1)\NrSongsOnPage)*NrSongsOnPage
  5147.           Else
  5148.             Pos = Pos - NrSongsOnPage
  5149.           End If
  5150.           mp9browsePlaylist
  5151.         Case "#"
  5152.           j = WMPplaylist.count        ' doesnt work, i have no idea why //mhr
  5153.           If (j>NrSongsOnPage) Then
  5154.             mp9listJump 2
  5155.           End If
  5156.         Case Else
  5157.       End Select
  5158.   End Select
  5159. End Sub
  5160.  
  5161. 'id=13
  5162. Sub zoomPlayerKeyEvent(button, state)
  5163.   Select Case CurrentItem
  5164.     Case "menu"
  5165.       Select Case button
  5166.         Case ">"  zoomPlayerNext
  5167.         Case "<"  zoomPlayerPrev
  5168.         Case Else
  5169.       End Select
  5170.   End Select
  5171. End Sub
  5172.  
  5173. 'id=16
  5174. Sub RadLightKeyEvent(button, state)
  5175.   Select Case CurrentItem
  5176.     Case "menu"
  5177.       Select Case button
  5178.         Case ">"  RadLightNext
  5179.         Case "<"  RadLightPrev
  5180.         Case Else
  5181.       End Select
  5182.   End Select
  5183. End Sub
  5184.  
  5185. 'id=2
  5186. Sub winampKeyEvent(button, state)     'winamp key events
  5187.   Select Case CurrentItem
  5188.     Case "menu"
  5189.       Select Case button
  5190.         Case ">"  winampNextSong
  5191.         Case "<"  winampPrevSong
  5192.         Case Else
  5193.       End Select
  5194.  
  5195.     Case "playlist"
  5196.       Select Case button
  5197.         Case ">"  nextPlayList
  5198.         Case "<"  prevPlayList
  5199.         Case Else
  5200.         If (SimpleSearchOn) Then
  5201.           Select Case button
  5202.             Case "#"   nextSearch
  5203.             Case "*"   prevSearch
  5204.           End Select
  5205.         End If
  5206.       End Select
  5207.  
  5208.     Case "selectPlaylist"
  5209.       Select Case button
  5210.         Case ">"  nextBrowse
  5211.         Case "<"  prevBrowse
  5212.       End Select
  5213.     Case "songInfo"
  5214.       Select Case button
  5215.         Case ">"  songInfo2
  5216.         Case "<"  songInfo2
  5217.       End Select
  5218.  
  5219.     Case "songInfo2"
  5220.       Select Case button
  5221.         Case ">"  songInfo LastArg1
  5222.         Case "<"  songInfo LastArg1
  5223.       End Select
  5224.     Case "searchInput"
  5225.       If (button = BackButton) Then winampSearch
  5226.     Case "simpleSearch"
  5227.       If (button = BackButton) Then playlistOptions
  5228.     Case "gotoSong"
  5229.       If (button = BackButton) Then playlistOptions
  5230.     Case "artistResults"
  5231.       Select Case button
  5232.         Case ">"  nextArtists
  5233.         Case "<"  prevArtists
  5234.       End Select
  5235.     Case "allArtists"
  5236.       Select Case button
  5237.         Case ">"  nextArtists
  5238.         Case "<"  prevArtists
  5239.       End Select
  5240.   End Select
  5241. End Sub
  5242.  
  5243. 'id=10
  5244. Sub winDVDKeyEvent(button, state)
  5245.   Select Case CurrentItem
  5246.     Case "menu"
  5247.       Select Case button
  5248.         Case ">"
  5249.           If (ChapterBool) Then
  5250.             winDVDNext
  5251.           Else
  5252.             winDVDFastForward
  5253.           End If
  5254.         Case "<"
  5255.           If (ChapterBool) Then
  5256.             winDVDPrev
  5257.           Else
  5258.             winDVDRewind
  5259.           End If
  5260.       End Select
  5261.   End Select
  5262. End Sub
  5263.  
  5264. 'id=11
  5265. Sub iTunesKeyEvent(button, state)
  5266.   Select Case CurrentItem
  5267.     Case "menu"
  5268.       Select Case button
  5269.         Case ">"
  5270.           iTNext
  5271.         Case "<"
  5272.           iTPrev
  5273.       End Select
  5274.   End Select
  5275. End Sub
  5276.  
  5277. 'id=15
  5278. Sub iexploreKeyEvent(button, state)
  5279.   Select Case CurrentItem
  5280.     Case "menu"
  5281.       Select Case button
  5282.         Case ">"
  5283.           If (not EnterTextBool) Then IEforward
  5284.         Case "<"
  5285.           If (not EnterTextBool) Then IEback
  5286.         Case "*"
  5287.           If (not EnterTextBool) Then EnterTextIE3
  5288.         Case "#"
  5289.           If (not EnterTextBool) Then
  5290.             shell.AppActivate("Microsoft Internet Explorer")
  5291.             shell.SendKeys "{ENTER}"
  5292.             enterExplorer
  5293.           End If
  5294.       End Select
  5295.   End Select
  5296. End Sub
  5297.  
  5298. '---------------------------- read and save file functions --------------------
  5299.  
  5300. Sub saveSettings()
  5301.   Dim id
  5302.  
  5303.   Set File = Fso.OpenTextFile(SettingsFile,2,True)    '2nd argument = forwriting = 2
  5304.   File.WriteLine ScriptVersion
  5305.   File.WriteLine MyPhoneType(1)
  5306.  
  5307.   File.WriteLine NrSongsOnPage
  5308.   File.WriteLine SettingMuteOnCall
  5309.   File.WriteLine OnCallDecreaseValue
  5310.   File.WriteLine SettingStartOnConnect
  5311.  
  5312.   For each id in RootItems
  5313.     File.WriteLine id
  5314.   Next
  5315.  
  5316.   File.WriteLine "EOF"
  5317.  
  5318.   File.Close
  5319. End Sub
  5320.  
  5321. Sub deleteSettings()
  5322.     If (Fso.FileExists(SettingsFile)) Then
  5323.       Set File = Fso.GetFile(SettingsFile)
  5324.       File.Delete
  5325.     End If
  5326. End Sub
  5327.  
  5328. Sub readSettings()
  5329.   Dim i, temp, dummy, compatible
  5330.   compatible = "3.5"
  5331.  
  5332.   If (Fso.FileExists(SettingsFile)) Then
  5333.     Set File = Fso.OpenTextFile(SettingsFile, 1)    '1 = forreading
  5334.     temp = CStr(File.ReadLine)
  5335.  
  5336.     If(ScriptVersion <> temp) and (compatible <> temp) Then    '1st line in settings file denotes version of config file
  5337.       File.Close
  5338.       deleteSettings
  5339.     Else
  5340.       SaveSettingsBool = True
  5341.       MyPhoneType(1) = CInt(File.ReadLine)
  5342.  
  5343.       NrSongsOnPage = CInt(File.ReadLine)
  5344.       SettingMuteOnCall = CInt(File.ReadLine)
  5345.       OnCallDecreaseValue = CInt(File.ReadLine)
  5346.       SettingStartOnConnect = File.ReadLine
  5347.  
  5348.       ReDim RootItems(0)
  5349.  
  5350.       temp = File.ReadLine
  5351.       If (temp <> "EOF") Then
  5352.         While (temp <> "EOF")
  5353.           addRootItem(CInt(temp))
  5354.           temp = File.ReadLine
  5355.         Wend
  5356.       End If
  5357.       File.Close
  5358.  
  5359.       setPhone
  5360.     End If
  5361.   End If
  5362. End Sub
  5363.  
  5364. Sub saveArray            'needed for saving temparray to root array
  5365.   Dim limit, i
  5366.  
  5367.   limit = UBound(TempArray)
  5368.   ReDim RootItems(limit)
  5369.   For i=0 To limit
  5370.     RootItems(i) = TempArray(i)
  5371.   Next
  5372. End Sub
  5373.  
  5374.  
  5375. '---------------------------- End Active Menu ---------------------------------
  5376.  
  5377. '------------ begin camera ------------------------
  5378.  
  5379. Public WebcamStream
  5380.  
  5381. Sub OnTakeSinglePicture
  5382.   WebcamStream = FALSE
  5383.   OnTakeSinglePicture2
  5384. End Sub
  5385.  
  5386. Sub OnTakeSinglePicture2
  5387.  If fma.Connected = 1 Then
  5388.    TakePicture
  5389.  Else
  5390.    fma.Debug "Webcam - Not Connected to Phone"
  5391.  End If
  5392. End Sub
  5393.  
  5394. Sub OnStartWebcam
  5395.  If fma.Connected = 1 Then
  5396.    ' check if new can take picture on every 2 seconds
  5397.    ' (wait for previous call to finish)
  5398.    OnStopWebcam
  5399.    WebcamStream = FALSE
  5400.    fma.AddTimer 2000, "OnTakeSinglePicture2"
  5401.  Else
  5402.    MsgBox "Webcam - Not Connected to Phone"
  5403.  End If
  5404. End Sub
  5405.  
  5406. Sub OnStartWebcamStream
  5407.  If fma.Connected = 1 Then
  5408.    ' check if new can take picture on every 2 seconds
  5409.    ' (wait for previous call to finish)
  5410.    OnStopWebcam
  5411.    WebcamStream = TRUE
  5412.    fma.AddTimer 2000, "OnTakeSinglePicture2"
  5413.  Else
  5414.    MsgBox "Webcam - Not Connected to Phone"
  5415.  End If
  5416. End Sub
  5417.  
  5418. Sub OnStopWebcam
  5419.  fma.DeleteTimer "OnTakeSinglePicture2"
  5420. End Sub
  5421.  
  5422. Sub TakePicture
  5423.  Dim OutputFile
  5424.  If fma.Connected = 1 Then
  5425.    fma.Debug "Webcam - Picturing..."
  5426.  
  5427.    If (MyPhoneType(1)=1) Then
  5428. 'code for T610
  5429.      Transmit "at+clck=""CS"",0" ' Unlock phone
  5430.      fma.Sleep (1000)
  5431.      Transmit "AT+CKPD="":C""" ' Enter camera mode
  5432.      fma.Sleep (1000)
  5433.      Transmit "AT+CKPD="":C""" ' Take picture
  5434. 'end code for T610
  5435.    ElseIf (MyPhoneType(1)=2) Then
  5436. 'code for k700
  5437.      Transmit "at+CKPD=""*"""  ' press * and ] after it to unlock
  5438.      fma.Sleep (500)
  5439.      Transmit "at+CKPD=""]"""
  5440.      fma.Sleep (500)
  5441.      Transmit "AT+CKPD="":C"",10"
  5442.      fma.Sleep (2000)
  5443.      Transmit "at+CKPD=""5""" ' turn the light on
  5444.      fma.Sleep (500)
  5445.      Transmit "AT+CKPD="":C""" ' Take picture
  5446. 'end code for k700
  5447.    End If
  5448.  
  5449.    If (WebcamStream) Then
  5450.      OutputFile = "c:\SE_Webcam.jpg"
  5451.    Else
  5452.      ' create filename here to get the (more or less) exact time & date of the picture
  5453.      Outputfile = OutputDirectory & Year(Date) & "-" & LeadZero(Month(Date)) & "-" & LeadZero(Day(Date)) & "_" & LeadZero(Hour (time)) & "-" & LeadZero(Minute (time)) & "-" & LeadZero(Second (time)) & ".jpg"
  5454.    End If
  5455.  
  5456.    If (MyPhoneType(1)=1) Then
  5457. 'code for T610
  5458.      fma.Sleep (8000) 'old 9000
  5459.      Transmit "AT+CKPD="":C""" ' Save picture
  5460.      fma.Sleep (4000) 'old 5000
  5461.      Transmit "AT+CKPD="":R""" ' Return to main menu
  5462.      fma.Sleep (1000)
  5463.      Transmit "AT+CKPD="":R"""
  5464. 'end code for T610
  5465.    ElseIf (MyPhoneType(1)=2) Then
  5466. 'code for k700
  5467.      fma.Sleep (5000)
  5468.      Transmit "AT+CKPD="":R"",10" ' Return to standby mode
  5469.      fma.Sleep (1500)
  5470.      Transmit "at+CKPD=""*"""  ' press * and ] after it to lock
  5471.      fma.Sleep (500)
  5472.      Transmit "at+CKPD=""]"""
  5473.      fma.Sleep (500)
  5474. 'end code for k700
  5475.    End If
  5476.  
  5477.    fma.ObexCut outputfile, filename
  5478.    fma.Debug "Webcam - Picture taken"
  5479.  End If
  5480. End Sub
  5481.  
  5482.  
  5483. '------------ end camera ------------------------
  5484.  
  5485. Function LeadZero(ByVal N)
  5486.   if (N>=0) and (N<10) then LeadZero = "0" & N else LeadZero = "" & N
  5487. End Function
  5488.  
  5489. '---------------------------- Internet Explorer ------------------------------------
  5490. 'id=15
  5491. Sub enterExplorer()
  5492.   EnterTextBool = FALSE
  5493.   AppOpen = shell.AppActivate("Microsoft Internet Explorer")
  5494.   am.Clear
  5495.   iexplore
  5496. End Sub
  5497.  
  5498. Sub iexplore
  5499.   enterAppMenu(15)
  5500.  
  5501.   If (AppOpen) Then
  5502.     am.AddItem "Homepage", "IEhome"
  5503.     am.AddItem "Enter address", "enterIEadd"
  5504.     am.AddItem "<< Back", "IEback"
  5505.     am.AddItem ">> Forward", "IEforward"
  5506.     am.AddItem "Send e-mail", "sendMail1"
  5507.     am.AddItem "Close IE", "IEclose"
  5508.   Else
  5509.     am.AddItem "Launch IE", "launchIE"
  5510.     am.AddItem "Enter address", "enterIEadd2"
  5511.     am.AddItem "Send e-mail", "sendMail1"
  5512.   End If
  5513.  
  5514.   am.Back = "onAMRoot"
  5515.   am.NextState=2
  5516.   am.Update
  5517. End Sub
  5518.  
  5519. Sub launchIE()
  5520.   LaunchAppDlg
  5521.   shell.Exec RootEXE(15)
  5522.   AppOpen = TRUE
  5523.   iexplore
  5524. End Sub
  5525.  
  5526. Public EmailAdd
  5527. Public EmailSubj
  5528. Public EmailBody
  5529.  
  5530. Sub sendMail1()
  5531.   EnterTextBool = TRUE
  5532.   am.DlgInputStr "Enter address","Address:",30,"","sendMail2"
  5533.   am.NextState = 2
  5534.   am.Back = "enterExplorer"
  5535. End Sub
  5536.  
  5537. Sub sendMail2(s)
  5538.   EmailAdd = s
  5539.   am.Clear
  5540.   am.DlgInputStr "Enter subject","Subject:",35,"","sendMail3"
  5541.   am.NextState = 3
  5542.   am.Back = "enterExplorer"
  5543. End Sub
  5544.  
  5545. Sub sendMail3(s)
  5546.   EmailSubj = Replace(s," ", "%20")
  5547.   am.Clear
  5548.   am.DlgInputStr "Enter text","Text:",100,"","sendMailDlg"
  5549.   am.NextState = 4
  5550.   am.Back = "enterExplorer"
  5551. End Sub
  5552.  
  5553. Sub sendMailDlg(s)
  5554.   dim text1,text2,text3,text
  5555.   EmailBody = Replace(s," ", "%20")
  5556.   am.clear
  5557.   am.Title = "Preparing"
  5558.   am.AddItem "Cancel", "onAMRoot"
  5559.   am.DlgFeedBack "Preparing ...","onAMRoot"
  5560.   text1 = "mailto:" & EmailAdd
  5561.   text2 = "?subject=" & EmailSubj
  5562.   text3 = "&body=" & EmailBody
  5563.   text = text1 & text2 & text3
  5564.   Shell.Run "RunDLL32.EXE shell32.dll,ShellExec_RunDLL " & text
  5565.   fma.Sleep (2000)
  5566.   EnterTextBool = FALSE
  5567.   sendMailSubMenu
  5568. End Sub
  5569.  
  5570. Sub sendMailSubMenu
  5571.   am.Clear
  5572.   am.Title = "E-mail"
  5573.   am.AddItem "Send e-mail", "sendMail"
  5574.   am.AddItem "Cancel", "sendMailClose"
  5575.   am.Back = "sendMailClose"
  5576.   am.NextState=2
  5577.   am.Update
  5578. End Sub
  5579.  
  5580. Sub sendMail
  5581.   shell.SendKeys "%s"
  5582.   enterExplorer
  5583. End Sub
  5584.  
  5585. Sub sendMailClose
  5586.   shell.SendKeys "%{F4}"
  5587.   enterExplorer
  5588. End Sub
  5589.  
  5590. Sub IEclose()
  5591.   CloseAppDlg
  5592.   If shell.AppActivate("Microsoft Internet Explorer") Then shell.SendKeys("%{F4}")
  5593.   AppOpen = FALSE
  5594.   iexplore
  5595. End Sub
  5596.  
  5597. Sub IEhome
  5598.   shell.AppActivate("Microsoft Internet Explorer")
  5599.   shell.SendKeys "%{HOME}"
  5600.   am.Update
  5601. End Sub
  5602.  
  5603. Sub IEback
  5604.   shell.AppActivate("Microsoft Internet Explorer")
  5605.   shell.SendKeys "%{LEFT}"
  5606.   am.Update
  5607. End Sub
  5608.  
  5609. Sub IEforward
  5610.   shell.AppActivate("Microsoft Internet Explorer")
  5611.   shell.SendKeys "%{RIGHT}"
  5612.   am.Update
  5613. End Sub
  5614.  
  5615. Sub IEtabF
  5616.   shell.AppActivate("Microsoft Internet Explorer")
  5617.   shell.SendKeys "{TAB}"
  5618.   am.Update
  5619. End Sub
  5620. Sub IEtabB
  5621.   shell.AppActivate("Microsoft Internet Explorer")
  5622.   shell.SendKeys "+{TAB}"
  5623.   am.Update
  5624. End Sub
  5625.  
  5626. Sub enterIEadd
  5627.   EnterTextBool = TRUE
  5628.   am.DlgInputStr "Enter address","Address:",40,"","enterTextIE"
  5629.   am.NextState = 2
  5630.   am.Back = "enterExplorer"
  5631. End Sub
  5632.  
  5633. Sub enterIEadd2
  5634.   EnterTextBool = TRUE
  5635.   am.DlgInputStr "Enter address","Address:",40,"","enterTextIE2"
  5636.   am.NextState = 2
  5637.   am.Back = "enterExplorer"
  5638. End Sub
  5639.  
  5640. Sub enterTextIE(s)     'send entered string
  5641.   shell.AppActivate("Microsoft Internet Explorer")
  5642.   shell.SendKeys "%D"
  5643.   shell.SendKeys s
  5644.   shell.SendKeys "{ENTER}"
  5645.   enterExplorer
  5646. End Sub
  5647.  
  5648. Sub enterTextIE2(s)     'send entered string
  5649.   Shell.Run "RunDLL32.EXE url.dll, FileProtocolHandler " & s
  5650.   enterExplorer
  5651. End Sub
  5652.  
  5653. Sub enterTextIE3
  5654.   EnterTextBool = TRUE
  5655.   am.DlgInputStr "Input","Text:",50,"","enterTextIE4"
  5656.   am.NextState = 2
  5657.   am.Back = "enterExplorer"
  5658. End Sub
  5659.  
  5660. Sub enterTextIE4(s)     'send entered string
  5661.   shell.AppActivate("Microsoft Internet Explorer")
  5662.   shell.SendKeys s
  5663.   enterExplorer
  5664. End Sub
  5665.  
  5666. '----------------------------- Locate Phone -----------------------------------
  5667.  
  5668. Sub OnLocatePhone
  5669.   Dim cmd
  5670.   If fma.Connected = 1 Then
  5671.     LocatePhoneNow
  5672.   Else
  5673.     fma.Debug "Locate cannot work - Not Connected to Phone"
  5674.   End If
  5675. End Sub
  5676.  
  5677. Sub LocatePhoneNow
  5678.   Dim cmd
  5679.   If fma.Connected = 1 Then
  5680.   fma.Debug "Locating phone..."
  5681.  
  5682.   If (MyPhoneType(1)=1) Then
  5683.     cmd = "AT+CKPD="":R""" ' Return to main menu (just in case)
  5684.     Transmit cmd
  5685.     cmd = "AT+CKPD="":R"""
  5686.     Transmit cmd
  5687.     cmd = "AT+CKPD="":R"""
  5688.     Transmit cmd
  5689.     cmd = "at+clck=""CS"",0" ' Unlock phone
  5690.     Transmit cmd
  5691.     cmd = "AT+CKPD="":J""" ' Open menu
  5692.     Transmit cmd
  5693.     cmd = "AT+CKPD=""7""" ' Open Pictures & Sounds submenu
  5694.     Transmit cmd
  5695.     cmd = "AT+CKPD=""3""" ' Open Sounds menu
  5696.     Transmit cmd
  5697.     cmd = "AT+CKPD=""^""" ' Go to first sound at bottom
  5698.     Transmit cmd
  5699.     cmd = "AT+CKPD="":J""" ' Play sound
  5700.     Transmit cmd
  5701.     fma.Sleep (15000) ' Change this for play length (default 15000 - 15secs)
  5702.     cmd = "AT+CKPD="":R""" ' Return to main menu
  5703.     Transmit cmd
  5704.     cmd = "AT+CKPD="":R"""
  5705.     Transmit cmd
  5706.     cmd = "AT+CKPD="":R"""
  5707.     Transmit cmd
  5708.   ElseIf (MyPhoneType(1)=2) Then
  5709.     Transmit "AT+CKPD="":R""" ' Return to main menu
  5710.     fma.Sleep (600)
  5711.     Transmit "AT+CKPD="":R"""
  5712.     fma.Sleep (600)
  5713.     Transmit "AT+CKPD="":R"""
  5714.     fma.Sleep (600)
  5715.     Transmit "at+CKPD=""*"""  ' press * and ] after it to unlock
  5716.     fma.Sleep (600)
  5717.     Transmit "at+CKPD=""]"""
  5718.     fma.Sleep (600)
  5719.     Transmit "AT+CKPD="":J""" ' Open menu
  5720.     fma.Sleep (600)
  5721.     Transmit "AT+CKPD=""7""" ' Open Pictures & Sounds submenu
  5722.     fma.Sleep (600)
  5723.     Transmit "AT+CKPD=""2""" ' Open Sounds menu
  5724.     fma.Sleep (600)
  5725.     Transmit "AT+CKPD=""^""" ' Go to first sound at bottom
  5726.     fma.Sleep (600)
  5727.     Transmit "AT+CKPD="":J""" ' Play sound
  5728.     fma.Sleep (15000) ' Change this for play length (default 15000 - 15secs)
  5729.     Transmit "AT+CKPD="":R""" ' Return to main menu
  5730.     fma.Sleep (600)
  5731.     Transmit "AT+CKPD="":R"""
  5732.     fma.Sleep (600)
  5733.     Transmit "AT+CKPD="":R"""
  5734.   ElseIf (MyPhoneType(1)=3) Then
  5735.     cmd = "AT+CKPD=""e""" ' Return to main menu (just in case)
  5736.     Transmit cmd
  5737.     fma.Sleep (400)
  5738.     Transmit cmd
  5739.     fma.Sleep (400)
  5740.     Transmit cmd
  5741.     fma.Sleep (400)
  5742.     cmd = "at+clck=""CS"",0" ' Unlock phone
  5743.     Transmit cmd
  5744.     fma.Sleep (400)
  5745.     cmd = "AT+CKPD="">""" ' Open menu
  5746.     Transmit cmd
  5747.     fma.Sleep (400)
  5748.     cmd = "AT+CKPD=""4""" ' Open Pictures & Sounds submenu
  5749.     Transmit cmd
  5750.     fma.Sleep (400)
  5751.     cmd = "AT+CKPD=""4""" ' Open Sounds menu
  5752.     Transmit cmd
  5753.     fma.Sleep (400)
  5754.     cmd = "AT+CKPD=""^""" ' Go to first sound at bottom
  5755.     Transmit cmd
  5756.     fma.Sleep (15000) ' Change this for play length (default 15000 - 15secs)
  5757.     cmd = "AT+CKPD=""e""" ' Return to main menu
  5758.     Transmit cmd
  5759.     fma.Sleep (400)
  5760.     Transmit cmd
  5761.     fma.Sleep (400)
  5762.     Transmit cmd
  5763.   End If
  5764.   fma.Debug "Phone located"
  5765.   End If
  5766. End Sub
  5767.  
  5768. '--------------------------- End Locate Phone ---------------------------------
  5769.  
  5770.  
  5771. '------------------------ Begin MS Agent Speech ---------------------------------
  5772. ' SpeechSay by skyw33
  5773. ' Here's a function for having MS Agent speak anything you give it
  5774. ' Just specify where your agent character file is.
  5775. '
  5776. ' *** THIS IS WORK IN PROGRESS!!! ***
  5777. '
  5778. ' I posted the MS Agent Script a while back. The only way I've gotten it to work is
  5779. ' to "run" a separate, stand-alone script from within the fma script that contains
  5780. ' the instructions to launch Agent. So far, the things I've found that run in stand-alone
  5781. ' mode but don't run from within fma are this and the wscript.sleep function.
  5782.  
  5783. Sub SpeechSay(SpeechText)
  5784.   On Error Resume Next
  5785.   Set AgentControl = CreateObject("Agent.Control.1")
  5786.   If IsObject(AgentControl) Then
  5787.     AgentControl.Connected = True
  5788.     Dim floyd
  5789.     On Error Resume Next
  5790.     'edit here - specify where your agent character file is
  5791.     AgentControl.Characters.Load "floyd", "C:\WINDOWS\MSAGENT\CHARS\floyd.ACS"
  5792.     Set floyd = AgentControl.Characters ("floyd")
  5793.     floyd.Get "state", "Showing"
  5794.     floyd.Get "state", "Speaking"
  5795.     floyd.MoveTo 200, 200
  5796.     floyd.Show
  5797.     floyd.Get "state", "Moving"
  5798.     floyd.Speak (SpeechText)
  5799.     floyd.Hide
  5800.     'unload objects
  5801.     Set floyd = nothing
  5802.     Set AgentControl = nothing
  5803.   End If
  5804. End Sub
  5805.  
  5806. '--------------------------- End MS Agent Speech ---------------------------------
  5807.  
  5808.